<!DOCTYPE html>
<html lang="en" dir="ltr" prefix="bibo: http://purl.org/ontology/bibo/" typeof="bibo:Document">
<head>
<title>JSON-LD 1.0 Processing Algorithms and API</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">



<style type="text/css">
  .diff {
    font-weight:bold; color:#0a3;
  }
  .error a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
  }
</style>
<style>/*****************************************************************
 * ReSpec 3 CSS
 * Robin Berjon - http://berjon.com/
 *****************************************************************/

/* --- INLINES --- */
em.rfc2119 {
    text-transform:     lowercase;
    font-variant:       small-caps;
    font-style:         normal;
    color:              #900;
}

h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
    border: none;
}

dfn {
    font-weight:    bold;
}

a.internalDFN {
    color:  inherit;
    border-bottom:  1px solid #99c;
    text-decoration:    none;
}

a.externalDFN {
    color:  inherit;
    border-bottom:  1px dotted #ccc;
    text-decoration:    none;
}

a.bibref {
    text-decoration:    none;
}

cite .bibref {
    font-style: normal;
}

code {
    color:  #ff4500;
}


/* --- --- */
ol.algorithm { counter-reset:numsection; list-style-type: none; }
ol.algorithm li { margin: 0.5em 0; }
ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }

/* --- TOC --- */
.toc a, .tof a {
    text-decoration:    none;
}

a .secno, a .figno {
    color:  #000;
}

ul.tof, ol.tof {
    list-style: none outside none;
}

.caption {
    margin-top: 0.5em;
    font-style:   italic;
}

/* --- TABLE --- */
table.simple {
    border-spacing: 0;
    border-collapse:    collapse;
    border-bottom:  3px solid #005a9c;
}

.simple th {
    background: #005a9c;
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
}

.simple th[scope="row"] {
    background: inherit;
    color:  inherit;
    border-top: 1px solid #ddd;
}

.simple td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
}

.simple tr:nth-child(even) {
    background: #f0f6ff;
}

/* --- DL --- */
.section dd > p:first-child {
    margin-top: 0;
}

.section dd > p:last-child {
    margin-bottom: 0;
}

.section dd {
    margin-bottom:  1em;
}

.section dl.attrs dd, .section dl.eldef dd {
    margin-bottom:  0;
}
</style><style>/* --- EXAMPLES --- */
div.example-title {
    min-width: 7.5em;
    color: #b9ab2d;
}
div.example-title span {
    text-transform: uppercase;
}
aside.example, div.example, div.illegal-example {
    padding: 0.5em;
    margin: 1em 0;
    position: relative;
    clear: both;
}
div.illegal-example { color: red }
div.illegal-example p { color: black }
aside.example, div.example {
    padding: .5em;
    border-left-width: .5em;
    border-left-style: solid;
    border-color: #e0cb52;
    background: #fcfaee;
}

aside.example div.example {
    border-left-width: .1em;
    border-color: #999;
    background: #fff;
}
aside.example div.example div.example-title {
    color: #999;
}
</style><style>/* --- ISSUES/NOTES --- */
div.issue-title, div.note-title {
    padding-right:  1em;
    min-width: 7.5em;
    color: #b9ab2d;
}
div.issue-title { color: #e05252; }
div.note-title { color: #52e052; }
div.issue-title span, div.note-title span {
    text-transform: uppercase;
}
div.note, div.issue {
    margin-top: 1em;
    margin-bottom: 1em;
}
.note > p:first-child, .issue > p:first-child { margin-top: 0 }
.issue, .note {
    padding: .5em;
    border-left-width: .5em;
    border-left-style: solid;
}
div.issue, div.note {
    padding: 0.5em;
    margin: 1em 0;
    position: relative;
    clear: both;
}
span.note, span.issue { padding: .1em .5em .15em; }

.issue {
    border-color: #e05252;
    background: #fbe9e9;
}
.note {
    border-color: #52e052;
    background: #e9fbe9;
}


</style><style>/* --- WEB IDL --- */
pre.idl {
    border-top: 1px solid #90b8de;
    border-bottom: 1px solid #90b8de;
    padding:    1em;
    line-height:    120%;
}

pre.idl::before {
    content:    "WebIDL";
    display:    block;
    width:      150px;
    background: #90b8de;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

.idlType {
    color:  #ff4500;
    font-weight:    bold;
    text-decoration:    none;
}

/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID {
    font-weight:    bold;
    color:  #005a9c;
}
a.idlEnumItem {
    color:  #000;
    border-bottom:  1px dotted #ccc;
    text-decoration: none;
}

.idlSuperclass {
    font-style: italic;
    color:  #005a9c;
}

/*.idlAttribute*/
.idlAttrType, .idlFieldType, .idlMemberType {
    color:  #005a9c;
}
.idlAttrName, .idlFieldName, .idlMemberName {
    color:  #ff4500;
}
.idlAttrName a, .idlFieldName a, .idlMemberName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlMethod*/
.idlMethType, .idlCallbackType {
    color:  #005a9c;
}
.idlMethName {
    color:  #ff4500;
}
.idlMethName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlParam*/
.idlParamType {
    color:  #005a9c;
}
.idlParamName, .idlDefaultValue {
    font-style: italic;
}

.extAttr {
    color:  #666;
}

/*.idlConst*/
.idlConstType {
    color:  #005a9c;
}
.idlConstName {
    color:  #ff4500;
}
.idlConstName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlException*/
.idlExceptionID {
    font-weight:    bold;
    color:  #c00;
}

.idlTypedefID, .idlTypedefType {
    color:  #005a9c;
}

.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
    color:  #c00;
    font-weight:    normal;
}

.excName a {
    font-family:    monospace;
}

.idlRaises a.idlType, .excName a.idlType {
    border-bottom:  1px dotted #c00;
}

.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
    width:  45px;
    text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }

.idlImplements a {
    font-weight:    bold;
}

dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
    margin-left:    2em;
}

.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
    font-weight:    normal;
}

.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
    font-weight:    bold;
    color:  #000;
    font-family:    monospace;
}

.attributes dt code, .fields dt code, .dictionary-members dt code {
    background:  #ffffd2;
}

.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
    color:  #005a9c;
    background:  transparent;
    font-family:    inherit;
    font-weight:    normal;
    font-style: italic;
}

.methods dt code {
    background:  #d9e6f8;
}

.constants dt code {
    background:  #ddffd2;
}

.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
    margin-bottom:  1em;
}

table.parameters, table.exceptions {
    border-spacing: 0;
    border-collapse:    collapse;
    margin: 0.5em 0;
    width:  100%;
}
table.parameters { border-bottom:  1px solid #90b8de; }
table.exceptions { border-bottom:  1px solid #deb890; }

.parameters th, .exceptions th {
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
    font-family:    initial;
    font-weight:    normal;
    text-shadow:    #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }

.parameters td, .exceptions td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
    vertical-align: top;
}

.parameters tr:first-child td, .exceptions tr:first-child td {
    border-top: none;
}

.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
    width:  100px;
}

.parameters td.prmType {
    width:  120px;
}

table.exceptions table {
    border-spacing: 0;
    border-collapse:    collapse;
    width:  100%;
}
</style><link href="http://www.w3.org/community/src/css/spec/cg-final.css" rel="stylesheet"><!--[if lt IE 9]><script src='http://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--><!--[if lt IE 9]><script src='http://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--><!--[if lt IE 9]><script src='http://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--><style type='text/css'>
.diff-old-a {
  font-size: smaller;
  color: red;
}

.diff-new { background-color: yellow; }
.diff-chg { background-color: lime; }
.diff-new:before,
.diff-new:after
    { content: "\2191" }
.diff-chg:before, .diff-chg:after
    { content: "\2195" }
.diff-old { text-decoration: line-through; background-color: #FBB; }
.diff-old:before,
.diff-old:after
    { content: "\2193" }
:focus { border: thin red solid}
</style>
</head>


<body>
<div class="head">
<p>
<a href="http://www.w3.org/">
<img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72">
</a>
</p>
<h1 class="title" id="title">
JSON-LD
<del class="diff-old">Algorithms
</del>
1.0
<del class="diff-old">Algorithms
for
</del>
Processing
<del class="diff-old">JSON-LD
Documents
W3C
Editor's
Draft
25
December
2012
</del>
<ins class="diff-chg">Algorithms
and
API
</ins></h1><h2 id="final-community-group-specification-28-march-2013"><ins class="diff-chg">
Final
Community
Group
Specification
28
March
2013
</ins>
</h2>
<dl>
<dt>
<del class="diff-old">This
version:
http://dvcs.w3.org/hg/json-ld/raw-file/default/spec/ED/json-ld-api/20121225/index.html
</del>
Latest
<del class="diff-old">published
version:
</del>
<ins class="diff-chg">editor's
draft:
</ins>
</dt>
<dd>
<del class="diff-old">http://www.w3.org/TR/json-ld-api/
</del>
<a href="http://dvcs.w3.org/hg/json-ld/raw-file/spec/latest/json-ld-api/index.html">
<ins class="diff-chg">http://dvcs.w3.org/hg/json-ld/raw-file/spec/latest/json-ld-api/index.html
</ins>
</a>
</dd>
<dt>
<del class="diff-old">Latest
editor's
draft:
</del>
<ins class="diff-chg">Test
suite:
</ins>
</dt>
<dd>
<del class="diff-old">http://dvcs.w3.org/hg/json-ld/raw-file/default/spec/latest/json-ld-api/index.html
</del>
<a href="http://json-ld.org/test-suite/">
<ins class="diff-chg">http://json-ld.org/test-suite/
</ins>
</a>
</dd>
<dt>
Editors:
</dt>
<dd rel="bibo:editor" inlist="">
<span typeof="foaf:Person">
<del class="diff-old">Manu
Sporny
</del>
<a rel="foaf:homepage" property="foaf:name" content="Markus Lanthaler" href="http://www.markus-lanthaler.com/">
<ins class="diff-chg">Markus
Lanthaler
</ins>
</a>,
<del class="diff-old">Digital
Bazaar
</del>
<a rel="foaf:workplaceHomepage" href="http://www.tugraz.at/">
<ins class="diff-chg">Graz
University
of
Technology
</ins>
</a>
</span>
</dd>
<dd rel="bibo:editor" inlist="">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Gregg Kellogg" href="http://greggkellogg.net/">
Gregg
Kellogg
</a>,
<a rel="foaf:workplaceHomepage" href="http://kellogg-assoc.com/">
Kellogg
Associates
</a>
</span>
</dd>
<dd rel="bibo:editor" inlist="">
<span typeof="foaf:Person">
<del class="diff-old">Markus
Lanthaler
</del>
<a rel="foaf:homepage" property="foaf:name" content="Manu Sporny" href="http://manu.sporny.org/">
<ins class="diff-chg">Manu
Sporny
</ins>
</a>,
<del class="diff-old">Graz
University
of
Technology
</del>
<a rel="foaf:workplaceHomepage" href="http://digitalbazaar.com/">
<ins class="diff-chg">Digital
Bazaar
</ins>
</a>
</span>
</dd>
<dt>
Authors:
</dt>
<dd rel="dcterms:contributor">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Dave Longley" href="http://digitalbazaar.com/">
Dave
Longley
</a>,
<a rel="foaf:workplaceHomepage" href="http://digitalbazaar.com/">
Digital
Bazaar
</a>
</span>
</dd>
<dd rel="dcterms:contributor">
<span typeof="foaf:Person">
<del class="diff-old">Manu
Sporny
,
Digital
Bazaar
</del>
<a rel="foaf:homepage" property="foaf:name" content="Gregg Kellogg" href="http://greggkellogg.net/">
Gregg
Kellogg
</a>,
<a rel="foaf:workplaceHomepage" href="http://kellogg-assoc.com/">
Kellogg
Associates
</a>
</span>
</dd>
<dd rel="dcterms:contributor">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Markus Lanthaler" href="http://www.markus-lanthaler.com/">
Markus
Lanthaler
</a>,
<a rel="foaf:workplaceHomepage" href="http://www.tugraz.at/">
Graz
University
of
Technology
</a>
</span>
</dd>
<dd rel="dcterms:contributor">
<span typeof="foaf:Person">
<a rel="foaf:homepage" property="foaf:name" content="Manu Sporny" href="http://digitalbazaar.com/">
<ins class="diff-new">Manu
Sporny
</ins></a>,<a rel="foaf:workplaceHomepage" href="http://digitalbazaar.com/"><ins class="diff-new">
Digital
Bazaar
</ins></a></span></dd>
</dl>
<p>
This
document
is
also
available
in
this
non-normative
format:
<a rel="alternate" href="diff-20121225.html">
diff
to
previous
version
</a>
</p>
<p class="copyright">
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
Copyright
</a>
©
<del class="diff-old">2010-2012
W3C
®
(
MIT
,
ERCIM
,
Keio
</del>
<ins class="diff-chg">2010-2013
the
Contributors
to
the
JSON-LD
1.0
Processing
Algorithms
and
API
Specification,
published
by
the
</ins><a href="http://www.w3.org/2011/rdf-wg/"><ins class="diff-chg">
RDF
Working
Group
</ins>
</a>
<del class="diff-old">),
All
Rights
Reserved.
</del>
<ins class="diff-chg">under
the
</ins><a href="https://www.w3.org/community/about/agreements/fsa/">
W3C
<del class="diff-old">liability
,
trademark
and
document
use
</del>
<ins class="diff-chg">Community
Final
Specification
Agreement
(FSA)
</ins></a>.<ins class="diff-chg">
A
human-readable
</ins><a href="http://www.w3.org/community/about/agreements/fsa-deed/"><ins class="diff-chg">
summary
</ins>
</a>
<del class="diff-old">rules
apply.
</del>
<ins class="diff-chg">is
available.
</ins>
</p>
<hr>
</div>
<section rel="bibo:chapter" resource="#abstract" typeof="bibo:Chapter" datatype="" property="dcterms:abstract" class="introductory" id="abstract">
<h2>
Abstract
</h2>
<p>
<del class="diff-old">JSON
[
RFC4627
]
has
proven
to
be
a
highly
useful
object
serialization
and
messaging
format.
JSON-LD
[
JSON-LD
]
harmonizes
the
representation
of
Linked
Data
in
JSON
by
outlining
a
common
JSON
representation
format
for
expressing
directed
graphs;
mixing
both
Linked
Data
and
non-Linked
Data
in
a
single
document.
</del>
This
<del class="diff-old">document
outlines
</del>
<ins class="diff-chg">specification
defines
</ins>
an
Application
Programming
Interface
<ins class="diff-new">(API)
</ins>
and
a
set
of
algorithms
for
<del class="diff-old">programmatically
transforming
</del>
<ins class="diff-chg">programmatic
transformations
of
</ins>
JSON-LD
<del class="diff-old">documents
</del>
<ins class="diff-chg">documents.
By
expressing
the
data
</ins>
in
<del class="diff-old">order
to
make
them
easier
</del>
<ins class="diff-chg">a
way
that
is
specifically
tailored
</ins>
to
<del class="diff-old">work
with
in
programming
environments
like
JavaScript,
Python,
and
Ruby.
</del>
<ins class="diff-chg">a
particular
use
case,
the
processing
typically
becomes
much
simpler.
</ins>
</p>
</section>
<section rel="bibo:chapter" resource="#sotd" typeof="bibo:Chapter" id="sotd" class="introductory">
<h2>
Status
of
This
Document
</h2>
<p>
This
<del class="diff-old">section
describes
the
status
of
this
document
at
</del>
<ins class="diff-chg">specification
was
published
by
</ins>
the
<del class="diff-old">time
of
its
publication.
Other
documents
may
supersede
this
document.
A
list
of
current
</del>
<a href="http://www.w3.org/2011/rdf-wg/">
<ins class="diff-chg">RDF
Working
Group
</ins></a>.<ins class="diff-chg">
It
is
not
a
</ins>
W3C
<del class="diff-old">publications
and
</del>
<ins class="diff-chg">Standard
nor
is
it
on
</ins>
the
<del class="diff-old">latest
revision
of
this
technical
report
can
be
found
in
</del>
<ins class="diff-chg">W3C
Standards
Track.
Please
note
that
under
</ins>
the
<a href="https://www.w3.org/community/about/agreements/final/">
W3C
<del class="diff-old">technical
reports
index
</del>
<ins class="diff-chg">Community
Final
Specification
Agreement
(FSA)
</ins>
</a>
<del class="diff-old">at
http://www.w3.org/TR/.
</del>
<ins class="diff-chg">other
conditions
apply.
Learn
more
about
</ins><a href="http://www.w3.org/community/"><ins class="diff-chg">
W3C
Community
and
Business
Groups
</ins></a>.
</p>
<p>
This
document
has
been
under
development
for
over
<del class="diff-old">18
</del>
<ins class="diff-chg">25
</ins>
months
in
the
JSON
for
Linking
Data
Community
Group.
The
document
has
recently
been
transferred
to
the
RDF
Working
Group
for
review,
improvement,
and
publication
along
the
Recommendation
track.
The
specification
has
undergone
significant
development,
review,
and
changes
during
the
course
of
the
last
<del class="diff-old">18
</del>
<ins class="diff-chg">25
</ins>
months.
</p>
<p>
There
are
several
independent
<a href="http://json-ld.org/#impl">
interoperable
implementations
</a>
of
this
specification.
There
is
a
<a href="https://github.com/json-ld/json-ld.org/tree/main/test-suite">
fairly
complete
test
suite
</a>
and
a
<a href="http://json-ld.org/playground/">
live
JSON-LD
editor
</a>
that
is
capable
of
demonstrating
the
features
described
in
this
document.
While
<ins class="diff-new">there
will
be
continuous
</ins>
development
on
implementations,
the
test
<del class="diff-old">suite
</del>
<ins class="diff-chg">suite,
</ins>
and
the
live
<del class="diff-old">editor
will
continue,
</del>
<ins class="diff-chg">editor,
</ins>
they
are
believed
to
be
mature
enough
to
be
integrated
into
a
non-production
system
at
this
point
in
<del class="diff-old">time
with
the
</del>
<ins class="diff-chg">time.
There
is
an
</ins>
expectation
that
they
could
be
used
in
a
production
system
within
the
next
<del class="diff-old">year.
</del>
<ins class="diff-chg">six
months.
</ins>
</p>
<div class="issue">
<div class="issue-title">
<span>
Issue
</span>
</div>
<p class="">
It
is
important
for
readers
to
understand
that
the
scope
of
this
document
is
currently
under
debate
and
new
features
may
be
added
to
the
specification.
Existing
features
may
be
modified
heavily
or
removed
entirely
from
the
specification
upon
further
review
and
feedback
from
the
broader
community.
This
is
a
work
in
progress
and
publication
as
a
Working
Draft
does
not
require
that
all
Working
Group
members
agree
on
the
content
of
the
document.
</p>
</div>
<p>
There
are
a
number
of
ways
that
one
may
participate
in
the
development
of
this
specification:
</p>
<ul>
<li>
If
you
want
to
make
sure
that
your
feedback
is
formally
addressed
by
the
RDF
Working
Group,
you
should
send
it
to
public-rdf-comments:
<a href="http://lists.w3.org/Archives/Public/public-rdf-comments/">
public-rdf-comments@w3.org
</a>
</li>
<li>
Ad-hoc
technical
discussion
primarily
occurs
on
the
public
community
mailing
list:
<a href="http://lists.w3.org/Archives/Public/public-linked-json/">
public-linked-json@w3.org
</a>
</li>
<li>
<a href="http://json-ld.org/minutes/">
Public
JSON-LD
Community
Group
teleconferences
</a>
are
held
on
Tuesdays
at
1500UTC
every
week.
Participation
is
open
to
the
public.
</li>
<li>
RDF
Working
Group
teleconferences
are
held
on
Wednesdays
at
1500UTC
every
week.
Participation
is
limited
to
RDF
Working
Group
members.
</li>
<li>
Specification
bugs
and
issues
should
be
reported
in
the
<a href="https://github.com/json-ld/json-ld.org/issues">
issue
tracker
</a>
if
you
do
not
want
to
send
an
<del class="diff-old">e-mail
</del>
<ins class="diff-chg">email
</ins>
to
the
public-rdf-comments
mailing
list.
</li>
<li>
<a href="https://github.com/json-ld/json-ld.org/tree/main/spec">
Source
code
</a>
for
the
specification
can
be
found
on
Github.
</li>
<li>
The
<a href="http://webchat.freenode.net/?channels=json-ld">
#json-ld
</a>
IRC
channel
is
available
for
real-time
discussion
on
irc.freenode.net.
</li>
</ul>
<del class="diff-old">This
document
was
published
by
the
RDF
Working
Group
as
an
Editor's
Draft.
If
you
wish
to
make
comments
regarding
this
document,
please
send
them
to
public-rdf-comments@w3.org
(
subscribe
,
archives
).
All
feedback
is
welcome.
Publication
as
an
Editor's
Draft
does
not
imply
endorsement
by
the
W3C
Membership.
This
is
a
draft
document
and
may
be
updated,
replaced
or
obsoleted
by
other
documents
at
any
time.
It
is
inappropriate
to
cite
this
document
as
other
than
work
in
progress.
This
document
was
produced
by
a
group
operating
under
the
5
February
2004
W3C
Patent
Policy
.
W3C
maintains
a
public
list
of
any
patent
disclosures
made
in
connection
with
the
deliverables
of
the
group;
that
page
also
includes
instructions
for
disclosing
a
patent.
An
individual
who
has
actual
knowledge
of
a
patent
which
the
individual
believes
contains
Essential
Claim(s)
must
disclose
the
information
in
accordance
with
section
6
of
the
W3C
Patent
Policy
.
</del>
</section>
<section id="toc">
<h2 class="introductory">
Table
of
Contents
</h2>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#introduction">
<span class="secno">
1.
</span>
Introduction
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#features">
<span class="secno">
2.
</span>
Features
</a>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#expansion">
<span class="secno">
2.1
</span>
Expansion
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#compaction">
<span class="secno">
2.2
</span>
Compaction
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#flattening">
<span class="secno">
2.3
</span>
Flattening
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#rdf-conversion">
<span class="secno">
2.4
</span>
RDF
Conversion
</a>
</li>
</ul>
</li>
<li class="tocline">
<a class="tocxref" href="#conformance">
<span class="secno">
3.
</span>
Conformance
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#general-terminology">
<span class="secno">
4.
</span>
General
Terminology
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#algorithm-terms">
<span class="secno">
5.
</span>
<del class="diff-old">Algorithms
</del>
<ins class="diff-chg">Algorithm
Terms
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#context-processing-algorithms">
<span class="secno">
<del class="diff-old">5.1
</del>
<ins class="diff-chg">6.
</ins>
</span>
<del class="diff-old">Algorithm
Terms
</del>
<ins class="diff-chg">Context
Processing
Algorithms
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#context-processing-algorithm">
<span class="secno">
<del class="diff-old">5.2
</del>
<ins class="diff-chg">6.1
</ins>
</span>
<del class="diff-old">Expansion
</del>
<ins class="diff-chg">Context
Processing
</ins>
Algorithm
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#create-term-definition">
<span class="secno">
<del class="diff-old">5.3
</del>
<ins class="diff-chg">6.2
</ins>
</span>
<del class="diff-old">Context
Processing
</del>
<ins class="diff-chg">Create
Term
Definition
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#iri-expansion">
<span class="secno">
<del class="diff-old">5.4
</del>
<ins class="diff-chg">6.3
</ins>
</span>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</a>
</li>
</ul>
</li>
<li class="tocline">
<a class="tocxref" href="#expansion-algorithms">
<span class="secno">
<del class="diff-old">5.5
</del>
<ins class="diff-chg">7.
</ins>
</span>
<del class="diff-old">Value
</del>
Expansion
<ins class="diff-new">Algorithms
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#expansion-algorithm">
<span class="secno">
<del class="diff-old">5.6
</del>
<ins class="diff-chg">7.1
</ins>
</span>
<del class="diff-old">Label
Blank
Nodes
</del>
<ins class="diff-chg">Expansion
</ins>
Algorithm
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#value-expansion">
<span class="secno">
<del class="diff-old">5.7
</del>
<ins class="diff-chg">7.2
</ins>
</span>
<del class="diff-old">Generate
Blank
Node
Identifier
</del>
<ins class="diff-chg">Value
Expansion
</ins>
</a>
</li>
</ul>
</li>
<li class="tocline">
<a class="tocxref" href="#compaction-algorithms">
<span class="secno">
<del class="diff-old">5.8
</del>
<ins class="diff-chg">8.
</ins>
</span>
Compaction
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">Algorithms
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#compaction-algorithm">
<span class="secno">
<del class="diff-old">5.9
</del>
<ins class="diff-chg">8.1
</ins>
</span>
<del class="diff-old">IRI
</del>
Compaction
Algorithm
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#inverse-context-creation">
<span class="secno">
<del class="diff-old">5.10
</del>
<ins class="diff-chg">8.2
</ins>
</span>
Inverse
Context
Creation
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#iri-compaction">
<span class="secno">
<del class="diff-old">5.11
</del>
<ins class="diff-chg">8.3
</ins>
</span>
<del class="diff-old">Inverse
Context
Query
Algorithm
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Compaction
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#term-selection">
<span class="secno">
<del class="diff-old">5.12
</del>
<ins class="diff-chg">8.4
</ins>
</span>
<del class="diff-old">Value
Compaction
</del>
<ins class="diff-chg">Term
Selection
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#value-compaction">
<span class="secno">
<del class="diff-old">5.13
</del>
<ins class="diff-chg">8.5
</ins>
</span>
<del class="diff-old">Find
and
Remove
Property
Generator
Duplicates
</del>
<ins class="diff-chg">Value
Compaction
</ins>
</a>
</li>
</ul>
</li>
<li class="tocline">
<a class="tocxref" href="#flattening-algorithms">
<span class="secno">
<del class="diff-old">5.14
</del>
<ins class="diff-chg">9.
</ins>
</span>
Flattening
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">Algorithms
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#flattening-algorithm">
<span class="secno">
<del class="diff-old">5.15
</del>
<ins class="diff-chg">9.1
</ins>
</span>
<del class="diff-old">Node
Map
Generation
</del>
<ins class="diff-chg">Flattening
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#node-map-generation">
<span class="secno">
<del class="diff-old">5.16
</del>
<ins class="diff-chg">9.2
</ins>
</span>
<del class="diff-old">RDF
Conversion
Algorithms
</del>
<ins class="diff-chg">Node
Map
Generation
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#generate-blank-node-identifier">
<span class="secno">
<del class="diff-old">5.16.1
</del>
<ins class="diff-chg">9.3
</ins>
</span>
<del class="diff-old">Convert
to
RDF
Algorithm
</del>
<ins class="diff-chg">Generate
Blank
Node
Identifier
</ins>
</a>
</li>
</ul>
</li>
<li class="tocline">
<a class="tocxref" href="#rdf-conversion-algorithms">
<span class="secno">
<del class="diff-old">5.16.2
</del>
<ins class="diff-chg">10.
</ins>
</span>
<del class="diff-old">List
</del>
<ins class="diff-chg">RDF
</ins>
Conversion
<ins class="diff-new">Algorithms
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#convert-to-rdf-algorithm">
<span class="secno">
<del class="diff-old">5.16.3
</del>
<ins class="diff-chg">10.1
</ins>
</span>
Convert
<del class="diff-old">from
</del>
<ins class="diff-chg">to
</ins>
RDF
Algorithm
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#object-to-rdf-conversion">
<span class="secno">
<del class="diff-old">5.16.4
</del>
<ins class="diff-chg">10.2
</ins>
</span>
<del class="diff-old">Data
Round
Tripping
</del>
<ins class="diff-chg">Object
to
RDF
Conversion
</ins>
</a>
</li>
<li class="tocline">
<del class="diff-old">6.
The
Application
Programming
Interface
</del>
<a class="tocxref" href="#list-to-rdf-conversion">
<span class="secno">
<del class="diff-old">6.1
</del>
<ins class="diff-chg">10.3
</ins>
</span>
<del class="diff-old">JsonLdProcessor
</del>
<ins class="diff-chg">List
to
RDF
Conversion
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#convert-from-rdf-algorithm">
<span class="secno">
<del class="diff-old">6.1.1
</del>
<ins class="diff-chg">10.4
</ins>
</span>
<del class="diff-old">Methods
</del>
<ins class="diff-chg">Convert
from
RDF
Algorithm
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#rdf-to-object-conversion">
<span class="secno">
<del class="diff-old">6.2
</del>
<ins class="diff-chg">10.5
</ins>
</span>
<del class="diff-old">Callbacks
</del>
<ins class="diff-chg">RDF
to
Object
Conversion
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#data-round-tripping">
<span class="secno">
<del class="diff-old">6.2.1
</del>
<ins class="diff-chg">10.6
</ins>
</span>
<del class="diff-old">JsonLdCallback
</del>
<ins class="diff-chg">Data
Round
Tripping
</ins>
</a>
</li>
</ul>
</li>
<li class="tocline">
<a class="tocxref" href="#the-application-programming-interface">
<span class="secno">
<del class="diff-old">6.3
</del>
<ins class="diff-chg">11.
</ins>
</span>
<del class="diff-old">Data
Structures
</del>
<ins class="diff-chg">The
Application
Programming
Interface
</ins>
</a>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#jsonldprocessor">
<span class="secno">
<del class="diff-old">6.3.1
</del>
<ins class="diff-chg">11.1
</ins>
</span>
<del class="diff-old">JsonLdOptions
</del>
<ins class="diff-chg">JsonLdProcessor
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#callbacks">
<span class="secno">
<del class="diff-old">6.3.2
</del>
<ins class="diff-chg">11.2
</ins>
</span>
<del class="diff-old">JsonLdProcessingError
</del>
<ins class="diff-chg">Callbacks
</ins>
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#data-structures">
<span class="secno">
<del class="diff-old">6.3.3
</del>
<ins class="diff-chg">11.3
</ins>
</span>
<del class="diff-old">JsonLdErrorCode
</del>
<ins class="diff-chg">Data
Structures
</ins>
</a>
</li>
</ul>
</li>
<li class="tocline">
<a class="tocxref" href="#acknowledgements">
<span class="secno">
A.
</span>
Acknowledgements
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#references">
<span class="secno">
B.
</span>
References
</a>
<ul class="toc">
<li class="tocline">
<a class="tocxref" href="#normative-references">
<span class="secno">
B.1
</span>
Normative
references
</a>
</li>
<li class="tocline">
<a class="tocxref" href="#informative-references">
<span class="secno">
B.2
</span>
Informative
references
</a>
</li>
</ul>
</li>
</ul>
</section>
<section id="introduction" class="informative">
<h2>
<span class="secno">
1.
</span>
Introduction
</h2>
<p>
<em>
This
section
is
non-normative.
</em>
</p>
<p>
This
document
is
a
detailed
specification
for
an
Application
Programming
Interface
for
the
JSON-LD
<del class="diff-old">Syntax.
</del>
<ins class="diff-chg">syntax.
</ins>
The
document
is
primarily
intended
for
the
following
audiences:
</p>
<ul>
<li>
<ins class="diff-new">Developers
that
want
an
overview
of
the
JSON-LD
API.
</ins></li><li>
Web
authors
and
developers
that
want
a
very
detailed
view
of
how
a
JSON-LD
<del class="diff-old">processor
and
the
</del>
<ins class="diff-chg">Implementation
or
a
JSON-LD
Processor's
</ins>
API
operates.
</li>
<li>
Software
developers
that
want
to
implement
<del class="diff-old">processors
and
APIs
for
JSON-LD.
</del>
<ins class="diff-chg">the
algorithms
to
transform
JSON-LD
documents.
</ins>
</li>
</ul>
<p>
To
understand
the
basics
in
this
specification
you
must
first
be
familiar
with
JSON,
which
is
detailed
in
[
<cite>
<a href="#bib-RFC4627" class="bibref">
RFC4627
</a>
</cite>
].
You
must
also
understand
the
JSON-LD
Syntax
[
<cite>
<a href="#bib-JSON-LD" class="bibref">
JSON-LD
</a>
</cite>
],
which
is
the
base
syntax
used
by
all
of
the
algorithms
in
this
document.
To
understand
the
API
and
how
it
is
intended
to
operate
in
a
programming
environment,
it
is
useful
to
have
working
knowledge
of
the
JavaScript
programming
language
[
<cite>
<a href="#bib-ECMA-262" class="bibref">
ECMA-262
</a>
</cite>
]
and
WebIDL
[
<cite>
<a href="#bib-WEBIDL" class="bibref">
WEBIDL
</a>
</cite>
].
To
understand
how
JSON-LD
maps
to
RDF,
it
is
helpful
to
be
familiar
with
the
basic
RDF
concepts
[
<cite>
<del class="diff-old">RDF-CONCEPTS
</del>
<a href="#bib-RDF11-CONCEPTS" class="bibref">
<ins class="diff-chg">RDF11-CONCEPTS
</ins>
</a>
</cite>
].
</p>
</section>
<section id="features" class="informative">
<h2>
<span class="secno">
2.
</span>
Features
</h2>
<p>
<em>
This
section
is
non-normative.
</em>
</p>
<p>
The
JSON-LD
Syntax
specification
[
<cite>
<a href="#bib-JSON-LD" class="bibref">
JSON-LD
</a>
</cite>
]
outlines
a
<del class="diff-old">language
</del>
<ins class="diff-chg">syntax
</ins>
that
may
be
used
to
express
Linked
Data
in
JSON.
<del class="diff-old">Often,
</del>
<ins class="diff-chg">Because
there
is
more
than
one
way
to
express
Linked
Data
using
this
syntax,
</ins>
it
is
<ins class="diff-new">often
</ins>
useful
to
be
able
to
transform
JSON-LD
documents
so
that
they
may
be
<ins class="diff-new">more
</ins>
easily
<del class="diff-old">processed
</del>
<ins class="diff-chg">consumed
by
specific
applications.
</ins></p><p><ins class="diff-chg">
The
way
JSON-LD
allows
Linked
Data
to
be
expressed
</ins>
in
<del class="diff-old">various
programming
environments.
</del>
<ins class="diff-chg">a
way
that
is
specifically
tailored
to
a
particular
person
or
application
is
by
providing
a
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a>.<ins class="diff-chg">
By
providing
a
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a>,<ins class="diff-chg">
JSON
data
can
be
expressed
in
a
way
that
is
a
natural
fit
for
a
particular
person
or
application
whilst
also
indicating
how
the
data
should
be
understood
at
a
global
scale.
In
order
for
people
or
applications
to
share
data
that
was
created
using
a
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a><ins class="diff-chg">
that
is
different
from
their
own,
a
JSON-LD
processor
must
be
able
to
transform
a
document
from
one
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a><ins class="diff-chg">
to
another.
Instead
of
requiring
JSON-LD
processors
to
write
specific
code
for
every
imaginable
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a><ins class="diff-chg">
switching
scenario,
it
is
much
easier
to
specify
a
single
algorithm
that
can
remove
any
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a>.<ins class="diff-chg">
Similarly,
another
algorithm
can
be
specified
to
subsequently
apply
any
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a>.<ins class="diff-chg">
These
two
algorithms
represent
the
most
basic
transformations
of
JSON-LD
documents.
They
are
referred
to
as
</ins><a href="#dfn-expansion" title="expansion" class="tref internalDFN"><ins class="diff-chg">
expansion
</ins></a><ins class="diff-chg">
and
</ins><a href="#dfn-compaction" title="compaction" class="tref internalDFN"><ins class="diff-chg">
compaction
</ins></a>,<ins class="diff-chg">
respectively.
</ins>
</p>
<p>
There
are
four
major
types
of
transformation
that
are
discussed
in
this
document:
expansion,
compaction,
flattening,
and
RDF
conversion.
</p>
<section id="expansion" class="informative">
<h3>
<span class="secno">
2.1
</span>
Expansion
</h3>
<p>
<em>
This
section
is
non-normative.
</em>
</p>
<p>
<del class="diff-old">Software
algorithms
are
easiest
to
write
when
the
data
</del>
<ins class="diff-chg">The
algorithm
</ins>
that
<del class="diff-old">they
are
processing
have
</del>
<ins class="diff-chg">removes
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a><ins class="diff-chg">
is
called
</ins><dfn id="dfn-expansion" title="expansion"><ins class="diff-chg">
expansion
</ins></dfn>.<ins class="diff-chg">
Before
performing
any
other
transformations
on
</ins>
a
<del class="diff-old">regular
form.
Since
information
can
be
represented
by
</del>
JSON-LD
<del class="diff-old">in
a
variety
of
different
ways,
transforming
</del>
<ins class="diff-chg">document,
it
is
easiest
to
remove
any
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a><ins class="diff-chg">
from
it,
localizing
</ins>
all
<ins class="diff-new">information,
and
to
make
data
structures
more
regular.
</ins></p><p><ins class="diff-new">
To
get
an
idea
</ins>
of
<del class="diff-old">these
methods
into
a
uniform
structure
allows
</del>
<ins class="diff-chg">how
context
and
data
structuring
affects
</ins>
the
<del class="diff-old">developer
to
simplify
their
processing
code.
For
example,
note
</del>
<ins class="diff-chg">same
data,
here
is
an
example
of
JSON-LD
</ins>
that
<del class="diff-old">the
following
input
</del>
uses
only
<del class="diff-old">term
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">terms
</ins>
</a>
<del class="diff-old">s
</del>
and
is
fairly
compact:
</p>
<del class="diff-old">  {
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  },
  &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
  &quot;name&quot;: &quot;Markus Lanthaler&quot;,
  &quot;homepage&quot;: &quot;http://www.markus-lanthaler.com/&quot;
</del>
    <div class="example"><div class="example-title"><span>Example 1</span>: Sample JSON-LD document</div><pre class="example">{
<ins class="diff-chg">  "@context": {
    "name": "http://xmlns.com/foaf/0.1/name",
    "homepage": {
      "@id": "http://xmlns.com/foaf/0.1/homepage",
      "@type": "@id"
    }
  },
  "@id": "http://me.markus-lanthaler.com/",
  "name": "Markus Lanthaler",
  "homepage": "http://www.markus-lanthaler.com/"
</ins>
}
</pre>
</div>
<p>
The
next
input
example
uses
one
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
to
express
a
<del class="diff-old">property,
</del>
<ins class="diff-chg">property
and
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
to
encapsulate
another,
</ins>
but
leaves
the
rest
of
the
information
untouched.
</p>
<del class="diff-old">  {
  &quot;@context&quot;: {
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  },
  &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
  &quot;&quot;: &quot;Markus Lanthaler&quot;,
  &quot;homepage&quot;: &quot;http://www.markus-lanthaler.com/&quot;
</del>
    <div class="example"><div class="example-title"><span>Example 2</span>: Sample JSON-LD document using a IRI instead of a term to express a property</div><pre class="example">{
<ins class="diff-chg">  "@context": {
</ins>    <span class="diff">"website": "http://xmlns.com/foaf/0.1/homepage"</span>
<ins class="diff-chg">
  },
  "@id": "http://me.markus-lanthaler.com/",
  "<span class="diff">http://xmlns.com/foaf/0.1/name</span>": "Markus Lanthaler",
</ins>  <span class="diff">"website"</span>: <span class="diff">{ "@id":</span> "http://www.markus-lanthaler.com/" <span class="diff">}</span>
}
</pre>
</div>
<p>
<del class="diff-old">While
</del>
<ins class="diff-chg">Note
that
</ins>
both
inputs
are
valid
<del class="diff-old">JSON-LD,
writing
a
program
to
handle
every
permutation
of
possible
inputs
can
be
difficult,
especially
when
</del>
<ins class="diff-chg">JSON-LD
and
both
represent
</ins>
the
<del class="diff-old">incoming
</del>
<ins class="diff-chg">same
information.
The
difference
is
in
their
</ins><a href="#dfn-context" title="context" class="tref internalDFN">
context
<del class="diff-old">could
change
as
well.
To
</del>
</a>
<ins class="diff-chg">information
and
in
the
data
structures
used.
A
JSON-LD
processor
can
remove
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a><ins class="diff-chg">
and
</ins>
ensure
that
the
data
<del class="diff-old">can
be
given
a
</del>
<ins class="diff-chg">is
</ins>
more
<del class="diff-old">uniform
structure,
JSON-LD
introduces
the
notion
of
expansion.
</del>
<ins class="diff-chg">regular
by
employing
</ins><a href="#dfn-expansion" title="expansion" class="tref internalDFN"><ins class="diff-chg">
expansion
</ins></a>.</p><p><a href="#dfn-expansion" title="expansion" class="tref internalDFN">
Expansion
<del class="diff-old">performs
</del>
</a>
<ins class="diff-chg">has
</ins>
two
important
<del class="diff-old">operations.
The
first
is
to
expand
</del>
<ins class="diff-chg">goals:
removing
any
contextual
information
from
the
document,
and
ensuring
</ins>
all
values
<del class="diff-old">that
represent
IRIs
</del>
<ins class="diff-chg">are
represented
in
a
regular
form.
These
goals
are
accomplished
by
expanding
all
properties
</ins>
to
<a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN">
absolute
IRIs
<del class="diff-old">.
The
second
is
to
express
</del>
</a>
<ins class="diff-chg">and
by
expressing
</ins>
all
values
in
<a href="#dfn-array" title="array" class="tref internalDFN">
<ins class="diff-chg">arrays
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-expanded-form" title="expanded-form" class="tref internalDFN">
expanded
form
</a>.
<a href="#dfn-expanded-form" title="expanded-form" class="tref internalDFN">
<ins class="diff-new">Expanded
form
</ins></a><ins class="diff-new">
is
the
most
verbose
and
regular
way
of
expressing
of
values
in
JSON-LD;
all
contextual
information
from
the
document
is
instead
stored
locally
with
each
value.
</ins>
Running
the
<a href="#expansion-algorithm">
Expansion
algorithm
</a>
<ins class="diff-new">(
</ins><code class="idlMemberName"><a href="#widl-JsonLdProcessor-expand-void-object-object---DOMString-input-JsonLdCallback-callback-JsonLdOptions-options"><ins class="diff-new">
expand
</ins></a></code><ins class="diff-new">
operation)
</ins>
against
the
examples
provided
above
results
in
the
following
output:
</p>
<del class="diff-old">  [
  {
    &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Markus Lanthaler&quot; }
    ],
    &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [
      { &quot;@id&quot;: &quot;http://www.markus-lanthaler.com/&quot; }
    ]
  }
</del>
    <div class="example"><div class="example-title"><span>Example 3</span>: Expanded sample document</div><pre class="example">[
<ins class="diff-chg">  {
    "@id": "http://me.markus-lanthaler.com/",
    "http://xmlns.com/foaf/0.1/name": [
      { "@value": "Markus Lanthaler" }
    ],
    "http://xmlns.com/foaf/0.1/homepage": [
      { "@id": "http://www.markus-lanthaler.com/" }
    ]
  }
</ins>
]
</pre>
</div>
<p>
Note
that
in
the
output
above
all
<a href="#dfn-context" title="context" class="tref internalDFN">
context
</a>
definitions
have
been
removed,
all
<a href="#dfn-term" title="term" class="tref internalDFN">
terms
</a>
and
<del class="diff-old">prefixes
</del>
<a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN">
<ins class="diff-chg">compact
IRIs
</ins>
</a>
have
been
expanded
to
absolute
<a href="#dfn-iri" title="iri" class="tref internalDFN">
IRIs
</a>,
and
all
<a href="#dfn-json-ld-value" title="json-ld-value" class="tref internalDFN">
JSON-LD
values
</a>
are
expressed
in
<a href="#dfn-array" title="array" class="tref internalDFN">
<ins class="diff-chg">arrays
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-expanded-form" title="expanded-form" class="tref internalDFN">
expanded
form
</a>.
While
the
output
is
more
<ins class="diff-new">verbose
and
</ins>
difficult
for
a
human
to
read,
it
<del class="diff-old">is
easier
for
</del>
<ins class="diff-chg">establishes
</ins>
a
<del class="diff-old">software
program
to
process
</del>
<ins class="diff-chg">baseline
that
makes
JSON-LD
processing
easier
</ins>
because
of
its
very
regular
structure.
</p>
</section>
<section id="compaction" class="informative">
<h3>
<span class="secno">
2.2
</span>
Compaction
</h3>
<p>
<em>
This
section
is
non-normative.
</em>
</p>
<p>
While
<a href="#dfn-expansion" title="expansion" class="tref internalDFN">
expansion
<del class="diff-old">expands
</del>
</a>
<ins class="diff-chg">removes
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a><ins class="diff-chg">
from
</ins>
a
given
<del class="diff-old">input
as
much
as
possible,
compaction
performs
</del>
<ins class="diff-chg">input,
</ins><a href="#dfn-compaction" title="compaction" class="tref internalDFN"><ins class="diff-chg">
compaction's
</ins></a><ins class="diff-chg">
primary
function
is
to
perform
</ins>
the
opposite
operation:
<del class="diff-old">it
expresses
</del>
<ins class="diff-chg">to
express
</ins>
a
given
input
<del class="diff-old">as
succinctly
as
possible.
In
contrast
to
expansion
which
is
meant
</del>
<ins class="diff-chg">according
</ins>
to
<del class="diff-old">produce
something
</del>
<ins class="diff-chg">a
particular
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a>.<dfn id="dfn-compaction" title="compaction"><ins class="diff-chg">
Compaction
</ins></dfn><ins class="diff-chg">
applies
a
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a>
that
<ins class="diff-new">specifically
tailors
the
way
information
</ins>
is
<del class="diff-old">easy
to
process
by
software
programs,
compaction
is
meant
to
produce
something
</del>
<ins class="diff-chg">expressed
for
a
particular
person
or
application.
This
simplifies
applications
</ins>
that
<del class="diff-old">is
easy
</del>
<ins class="diff-chg">consume
JSON
or
JSON-LD
by
expressing
the
data
in
application-specific
terms,
and
it
makes
the
data
easier
</ins>
to
read
by
<del class="diff-old">software
developers.
</del>
<ins class="diff-chg">humans.
</ins></p><p><a href="#dfn-compaction" title="compaction" class="tref internalDFN">
Compaction
</a>
uses
a
developer-supplied
<a href="#dfn-context" title="context" class="tref internalDFN">
context
</a>
to
<del class="diff-old">compress
</del>
<ins class="diff-chg">shorten
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN">
IRIs
</a>
to
<a href="#dfn-term" title="term" class="tref internalDFN">
terms
</a>
or
<a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN">
compact
IRIs
</a>
and
<a href="#dfn-json-ld-value" title="json-ld-value" class="tref internalDFN">
JSON-LD
values
</a>
expressed
in
<a href="#dfn-expanded-form" title="expanded-form" class="tref internalDFN">
expanded
form
</a>
to
simple
values
such
as
<a href="#dfn-string" title="string" class="tref internalDFN">
strings
</a>
<del class="diff-old">and
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-number" title="number" class="tref internalDFN">
numbers
</a>.
</p>
<p>
For
example,
assume
the
following
expanded
JSON-LD
input
document:
</p>
<del class="diff-old">  [
  {
    &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Markus Lanthaler&quot; }
    ],
    &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [
      { &quot;@id&quot;: &quot;http://www.markus-lanthaler.com/&quot; }
    ]
  }
</del>
    <div class="example"><div class="example-title"><span>Example 4</span>: Expanded sample document</div><pre class="example">[
<ins class="diff-chg">  {
    "@id": "http://me.markus-lanthaler.com/",
    "http://xmlns.com/foaf/0.1/name": [
      { "@value": "Markus Lanthaler" }
    ],
    "http://xmlns.com/foaf/0.1/homepage": [
      { "@id": "http://www.markus-lanthaler.com/" }
    ]
  }
</ins>
]
</pre>
</div>
<p>
Additionally,
assume
the
following
developer-supplied
JSON-LD
<a href="#dfn-context" title="context" class="tref internalDFN">
context
</a>:
</p>
<del class="diff-old">  {
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  }
</del>
    <div class="example"><div class="example-title"><span>Example 5</span>: JSON-LD context</div><pre class="example">{
<ins class="diff-chg">  "@context": {
    "name": "http://xmlns.com/foaf/0.1/name",
    "homepage": {
      "@id": "http://xmlns.com/foaf/0.1/homepage",
      "@type": "@id"
    }
  }
</ins>
}
</pre>
</div>
<p>
Running
the
<a href="#compaction-algorithm">
Compaction
Algorithm
</a>
<ins class="diff-new">(
</ins><code class="idlMemberName"><a href="#widl-JsonLdProcessor-compact-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options"><ins class="diff-new">
compact
</ins></a></code><ins class="diff-new">
operation)
</ins>
given
the
context
supplied
above
against
the
JSON-LD
input
document
provided
above
would
result
in
the
following
output:
</p>
<del class="diff-old">  {
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;homepage&quot;: {
      &quot;@id&quot;: &quot;http://xmlns.com/foaf/0.1/homepage&quot;,
      &quot;@type&quot;: &quot;@id&quot;
    }
  },
  &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
  &quot;name&quot;: &quot;Markus Lanthaler&quot;,
  &quot;homepage&quot;: &quot;http://www.markus-lanthaler.com/&quot;
</del>
    <div class="example"><div class="example-title"><span>Example 6</span>: Compacted sample document</div><pre class="example">{
<ins class="diff-chg">  "@context": {
    "name": "http://xmlns.com/foaf/0.1/name",
    "homepage": {
      "@id": "http://xmlns.com/foaf/0.1/homepage",
      "@type": "@id"
    }
  },
  "@id": "http://me.markus-lanthaler.com/",
  "name": "Markus Lanthaler",
  "homepage": "http://www.markus-lanthaler.com/"
</ins>
}
</pre>
</div>
<p>
Note
that
all
<a href="#dfn-iri" title="iri" class="tref internalDFN">
IRIs
</a>
have
been
compacted
to
<a href="#dfn-term" title="term" class="tref internalDFN">
terms
</a>
as
specified
in
the
<a href="#dfn-context" title="context" class="tref internalDFN">
context
</a>,
which
<del class="diff-old">consequently
</del>
has
been
injected
into
the
output.
While
compacted
output
is
<del class="diff-old">most
</del>
useful
to
humans,
it
<del class="diff-old">can
often
</del>
<ins class="diff-chg">is
</ins>
also
<del class="diff-old">be
</del>
used
to
generate
structures
that
are
easy
to
program
against.
Compaction
enables
developers
to
map
any
expanded
document
into
an
application-specific
compacted
document.
While
the
context
provided
above
mapped
<code>
<del class="diff-old">http://xmlns.com/foaf/0.1/name
</del>
<ins class="diff-chg">http://xmlns.com/foaf/0.1/nam
</ins>
</code>
to
<code>
name
</code>,
it
could
<del class="diff-old">have
</del>
also
have
been
mapped
to
any
other
term
provided
by
the
developer.
</p>
</section>
<section id="flattening" class="informative">
<h3>
<span class="secno">
2.3
</span>
Flattening
</h3>
<p>
<em>
This
section
is
non-normative.
</em>
</p>
<p>
While
expansion
ensures
that
a
document
is
in
a
uniform
structure,
flattening
goes
a
step
further
<del class="diff-old">and
ensures
</del>
<ins class="diff-chg">to
ensure
</ins>
that
<del class="diff-old">also
</del>
the
shape
of
the
data
is
deterministic.
In
expanded
<del class="diff-old">documents
</del>
<ins class="diff-chg">documents,
the
</ins>
properties
of
a
single
<a href="#dfn-node" title="node" class="tref internalDFN">
node
</a>
may
<del class="diff-old">still
</del>
be
spread
across
a
number
of
different
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
objects
</a>.
By
flattening
a
document,
all
properties
of
a
<a href="#dfn-node" title="node" class="tref internalDFN">
node
</a>
are
collected
in
a
single
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
and
all
<a href="#dfn-blank-node" title="blank-node" class="tref internalDFN">
blank
nodes
</a>
are
labeled
with
a
<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
identifier
</a>.
<del class="diff-old">Often
this
</del>
<ins class="diff-chg">This
may
</ins>
drastically
<del class="diff-old">simplifies
</del>
<ins class="diff-chg">simplify
</ins>
the
code
<ins class="diff-new">required
</ins>
to
process
JSON-LD
<del class="diff-old">data.
</del>
<ins class="diff-chg">data
in
certain
applications.
</ins>
</p>
<p>
For
example,
assume
the
following
JSON-LD
input
document:
</p>
<del class="diff-old">  {
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;knows&quot;: &quot;http://xmlns.com/foaf/0.1/knows&quot;
  },
  &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
  &quot;name&quot;: &quot;Markus Lanthaler&quot;,
  &quot;knows&quot;: [
    {
      &quot;name&quot;: &quot;Manu Sporny&quot;,
      &quot;knows&quot;: {
        &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;
      }
    },
    {
      &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
      &quot;name&quot;: &quot;Gregg Kellogg&quot;
    }
  ]
</del>
    <div class="example"><div class="example-title"><span>Example 7</span>: Sample JSON-LD document</div><pre class="example">{
<ins class="diff-chg">  "@context": {
    "name": "http://xmlns.com/foaf/0.1/name",
    "knows": "http://xmlns.com/foaf/0.1/knows"
  },
  "@id": "http://me.markus-lanthaler.com/",
  "name": "Markus Lanthaler",
  "knows": [
    {
      "name": "Dave Longley"
    }
  ]
</ins>
}
</pre>
</div>
<p>
Running
the
<a href="#flattening-algorithm">
Flattening
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins>
</a>
<ins class="diff-new">(
</ins><code class="idlMemberName"><a href="#widl-JsonLdProcessor-flatten-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options"><ins class="diff-new">
flatten
</ins></a></code><ins class="diff-new">
operation)
</ins>
with
a
context
set
to
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>
to
prevent
compaction
returns
the
following
document:
</p>
<del class="diff-old">  [
  {
    &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Markus Lanthaler&quot; }
    ],
    &quot;http://xmlns.com/foaf/0.1/knows&quot;: [
      { &quot;@id&quot;: &quot;_:t0&quot; },
      { &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot; }
    ]
  },
  {
    &quot;@id&quot;: &quot;_:t0&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Manu Sporny&quot; }
    ],
    &quot;http://xmlns.com/foaf/0.1/knows&quot;: [
      { &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot; }
    ]
  },
  {
    &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      { &quot;@value&quot;: &quot;Gregg Kellogg&quot; }
    ]
  }
</del>
    <div class="example"><div class="example-title"><span>Example 8</span>: Flattened sample document in expanded form</div><pre class="example">[
<ins class="diff-chg">  {
    "@id": "_:t0",
    "http://xmlns.com/foaf/0.1/name": [
      { "@value": "Dave Longley" }
    ]
  },
  {
    "@id": "http://me.markus-lanthaler.com/",
    "http://xmlns.com/foaf/0.1/name": [
      { "@value": "Markus Lanthaler" }
    ],
    "http://xmlns.com/foaf/0.1/knows": [
      { "@id": "_:t0" }
    ]
  }
</ins>
]
</pre>
</div>
<p>
Note
how
in
the
output
above
all
properties
of
a
<a href="#dfn-node" title="node" class="tref internalDFN">
node
</a>
are
collected
in
a
single
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
and
how
the
<a href="#dfn-blank-node" title="blank-node" class="tref internalDFN">
blank
node
</a>
representing
<del class="diff-old">&quot;Manu
Sporny&quot;
</del>
<ins class="diff-chg">"Dave
Longley"
</ins>
has
been
assigned
the
<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
identifier
</a>
<code>
_:t0
</code>.
</p>
<p>
To
make
it
easier
for
humans
to
read
<del class="diff-old">such
</del>
<ins class="diff-chg">or
for
certain
applications
to
process
it,
</ins>
a
flattened
document
can
be
compacted
by
passing
a
context.
Using
the
same
context
as
the
input
document,
the
flattened
and
compacted
document
looks
as
follows:
</p>
<del class="diff-old">  {
  &quot;@context&quot;: {
    &quot;name&quot;: &quot;http://xmlns.com/foaf/0.1/name&quot;,
    &quot;knows&quot;: &quot;http://xmlns.com/foaf/0.1/knows&quot;
  },
  &quot;@graph&quot;: [
    {
      &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
      &quot;name&quot;: &quot;Markus Lanthaler&quot;,
      &quot;knows&quot;: [
        { &quot;@id&quot;: &quot;_:t0&quot; },
        { &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot; }
      ]
    },
    {
      &quot;@id&quot;: &quot;_:t0&quot;,
      &quot;name&quot;: &quot;Manu Sporny&quot;,
      &quot;knows&quot;: {
        &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;
      }
    },
    {
      &quot;@id&quot;: &quot;http://greggkellogg.net/foaf#me&quot;,
      &quot;name&quot;: &quot;Gregg Kellogg&quot;
    }
  ]
</del>
    <div class="example"><div class="example-title"><span>Example 9</span>: Flattened and compacted sample document</div><pre class="example">{
<ins class="diff-chg">  "@context": {
    "name": "http://xmlns.com/foaf/0.1/name",
    "knows": "http://xmlns.com/foaf/0.1/knows"
  },
  "@graph": [
    {
      "@id": "_:t0",
      "name": "Dave Longley"
    },
    {
      "@id": "http://me.markus-lanthaler.com/",
      "name": "Markus Lanthaler",
      "knows": { "@id": "_:t0" }
    }
  ]
</ins>
}
</pre>
</div>
<p>
Please
note
that
the
flattened
and
compacted
result
<del class="diff-old">will
</del>
always
explicitly
<del class="diff-old">designate
</del>
<ins class="diff-chg">designates
</ins>
the
default
<ins class="diff-new">graph
</ins>
by
the
<code>
@graph
</code>
member
in
the
top-level
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>.
<del class="diff-old">Compaction
optimizes
that
member
away
if
its
value
contains
just
one
item.
</del>
</p>
</section>
<section id="rdf-conversion" class="informative">
<h3>
<span class="secno">
2.4
</span>
RDF
Conversion
</h3>
<p>
<em>
This
section
is
non-normative.
</em>
</p>
<p>
JSON-LD
can
be
used
to
serialize
data
expressed
in
RDF
as
described
in
[
<cite>
<del class="diff-old">RDF-CONCEPTS
</del>
<a href="#bib-RDF11-CONCEPTS" class="bibref">
<ins class="diff-chg">RDF11-CONCEPTS
</ins>
</a>
</cite>
].
This
ensures
that
data
can
be
round-tripped
<del class="diff-old">from
and
</del>
to
<ins class="diff-new">and
from
</ins>
any
RDF
syntax
without
any
loss
in
<del class="diff-old">the
fidelity
of
the
data.
</del>
<ins class="diff-chg">fidelity.
</ins>
</p>
<p>
For
example,
assume
the
following
RDF
input
serialized
in
Turtle
[
<cite>
<del class="diff-old">TURTLE-TR
</del>
<a href="#bib-TURTLE" class="bibref">
<ins class="diff-chg">TURTLE
</ins>
</a>
</cite>
]:
</p>
<del class="diff-old">  &lt;http://me.markus-lanthaler.com/&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; &quot;Markus Lanthaler&quot; .
</del>
    <div class="example"><div class="example-title"><span>Example 10</span>: Sample Turtle document</div><pre class="example">&lt;http://me.markus-lanthaler.com/&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "Markus Lanthaler" .
&lt;http://me.markus-lanthaler.com/&gt;
&lt;http://xmlns.com/foaf/0.1/homepage&gt;
&lt;http://www.markus-lanthaler.com/&gt;
.
</pre>
</div>
<p>
Using
the
<a href="#convert-from-rdf-algorithm">
Convert
from
RDF
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins>
</a>
a
developer
could
transform
this
document
into
expanded
JSON-LD:
</p>
<del class="diff-old">  [
  {
    &quot;@id&quot;: &quot;http://me.markus-lanthaler.com/&quot;,
    &quot;http://xmlns.com/foaf/0.1/name&quot;: [
      {
        &quot;@value&quot;: &quot;Markus Lanthaler&quot;
      }
    ],
    &quot;http://xmlns.com/foaf/0.1/homepage&quot;: [
      {
        &quot;@id&quot;: &quot;http://www.markus-lanthaler.com/&quot;
      }
    ]
  }
</del>
    <div class="example"><div class="example-title"><span>Example 11</span>: Sample Turtle document converted to JSON-LD</div><pre class="example">[
<ins class="diff-chg">  {
    "@id": "http://me.markus-lanthaler.com/",
    "http://xmlns.com/foaf/0.1/name": [
      { "@value": "Markus Lanthaler" }
    ],
    "http://xmlns.com/foaf/0.1/homepage": [
      { "@id": "http://www.markus-lanthaler.com/" }
    ]
  }
</ins>
]
</pre>
</div>
<p>
Note
that
the
output
above
could
easily
be
compacted
using
the
technique
outlined
in
the
previous
section.
It
is
also
possible
to
transform
the
JSON-LD
document
back
to
RDF
using
the
<a href="#convert-to-rdf-algorithm">
Convert
to
RDF
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins>
</a>.
</p>
</section>
</section>
<section id="conformance">
<h2>
<span class="secno">
3.
</span>
Conformance
</h2>
<p>
All
examples
and
notes
as
well
as
sections
marked
as
non-normative
in
this
specification
are
non-normative.
Everything
else
in
this
specification
is
normative.
</p>
<p>
The
keywords
<del class="diff-old">must
</del>
<em title="MUST" class="rfc2119">
<ins class="diff-chg">MUST
</ins>
</em>,
<del class="diff-old">must
not
</del>
<em title="MUST NOT" class="rfc2119">
<ins class="diff-chg">MUST
NOT
</ins>
</em>,
<del class="diff-old">required
</del>
<em title="REQUIRED" class="rfc2119">
<ins class="diff-chg">REQUIRED
</ins>
</em>,
<del class="diff-old">should
</del>
<em title="SHOULD" class="rfc2119">
<ins class="diff-chg">SHOULD
</ins>
</em>,
<del class="diff-old">should
not
</del>
<em title="SHOULD NOT" class="rfc2119">
<ins class="diff-chg">SHOULD
NOT
</ins>
</em>,
<del class="diff-old">recommended
</del>
<em title="RECOMMENDED" class="rfc2119">
<ins class="diff-chg">RECOMMENDED
</ins>
</em>,
<del class="diff-old">may
</del>
<em title="MAY" class="rfc2119">
<ins class="diff-chg">MAY
</ins>
</em>,
and
<del class="diff-old">optional
</del>
<em title="OPTIONAL" class="rfc2119">
<ins class="diff-chg">OPTIONAL
</ins>
</em>
in
this
specification
are
to
be
interpreted
as
described
in
[
<cite>
<a href="#bib-RFC2119" class="bibref">
RFC2119
</a>
</cite>
].
</p>
<p>
There
are
two
classes
of
products
that
can
claim
conformance
to
this
specification:
<a href="#dfn-json-ld-implementation" title="json-ld-implementation" class="tref internalDFN">
JSON-LD
Implementations
</a>
and
<a href="#dfn-json-ld-processor" title="json-ld-processor" class="tref internalDFN">
JSON-LD
Processors
</a>.
</p>
<p>
A
conforming
<dfn id="dfn-json-ld-implementation" title="json-ld-implementation">
JSON-LD
Implementation
</dfn>
is
a
system
capable
of
transforming
JSON-LD
documents
according
the
algorithms
defined
in
this
specification.
</p>
<p>
A
conforming
<dfn id="dfn-json-ld-processor" title="json-ld-processor">
JSON-LD
Processor
</dfn>
is
a
conforming
<a href="#dfn-json-ld-implementation" title="json-ld-implementation" class="tref internalDFN">
JSON-LD
Implementation
</a>
that
exposes
the
<del class="diff-old">application
programming
interface
</del>
<ins class="diff-chg">Application
Programming
Interface
</ins>
(API)
defined
in
this
specification.
<ins class="diff-new">It
</ins><em title="MUST" class="rfc2119"><ins class="diff-new">
MUST
</ins></em><ins class="diff-new">
implement
the
</ins><code><ins class="diff-new">
json-ld-1.0
</ins></code><ins class="diff-new">
processing
mode
(for
further
details,
see
the
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-processingMode"><ins class="diff-new">
processingMode
</ins></a></code><ins class="diff-new">
option
of
</ins><a class="idlType" href="#idl-def-JsonLdOptions"><code><ins class="diff-new">
JsonLdOptions
</ins></code></a><ins class="diff-new">
).
</ins>
</p>
<p>
The
algorithms
in
this
specification
are
generally
written
with
more
concern
for
clarity
than
<del class="diff-old">over
</del>
efficiency.
Thus,
JSON-LD
Implementations
and
Processors
may
implement
the
algorithms
given
in
this
specification
in
any
way
desired,
so
long
as
the
end
result
is
indistinguishable
from
the
result
that
would
be
obtained
by
the
specification's
algorithms.
</p>
<p>
This
specification
does
not
define
how
JSON-LD
Implementations
or
Processors
handle
non-conforming
input
documents.
This
implies
that
JSON-LD
Implementations
or
Processors
<del class="diff-old">must
not
</del>
<em title="MUST NOT" class="rfc2119">
<ins class="diff-chg">MUST
NOT
</ins>
</em>
attempt
to
correct
malformed
<a href="#dfn-iri" title="iri" class="tref internalDFN">
IRIs
</a>
or
language
tags;
however,
they
<del class="diff-old">may
</del>
<em title="MAY" class="rfc2119">
<ins class="diff-chg">MAY
</ins>
</em>
issue
validation
warnings.
<ins class="diff-new">IRIs
are
not
modified
other
than
converted
between
</ins><a href="#dfn-relative-iri" title="relative-iri" class="tref internalDFN"><ins class="diff-new">
relative
</ins></a><ins class="diff-new">
and
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-new">
absolute
IRIs
</ins></a>.
</p>
<div class="note">
<div class="note-title">
<span>
Note
</span>
</div>
<p class="">
Implementers
can
partially
check
their
level
of
conformance
to
this
specification
by
successfully
passing
the
test
cases
of
the
JSON-LD
test
suite
[
<cite>
<a href="#bib-JSON-LD-TESTS" class="bibref">
JSON-LD-TESTS
</a>
</cite>
].
Note,
however,
that
passing
all
the
tests
in
the
test
suite
does
not
imply
complete
conformance
to
this
specification.
It
only
implies
that
the
implementation
conforms
to
aspects
tested
by
the
test
suite.
</p>
</div>
</section>
<section id="general-terminology">
<h2>
<span class="secno">
4.
</span>
General
Terminology
</h2>
<p>
This
document
uses
the
following
terms
as
defined
in
JSON
[
<cite>
<a href="#bib-RFC4627" class="bibref">
RFC4627
</a>
</cite>
].
Refer
to
the
<em>
JSON
Grammar
</em>
section
in
[
<cite>
<a href="#bib-RFC4627" class="bibref">
RFC4627
</a>
</cite>
]
for
formal
definitions.
</p>
<dl>
<dt>
<dfn id="dfn-json-object" title="json-object">
JSON
object
</dfn>
</dt>
<dd>
An
object
structure
is
represented
as
a
pair
of
curly
brackets
surrounding
zero
or
more
key-value
pairs.
A
key
is
a
<a href="#dfn-string" title="string" class="tref internalDFN">
string
</a>.
A
single
colon
comes
after
each
key,
separating
the
key
from
the
value.
A
single
comma
separates
a
value
from
a
following
key.
<ins class="diff-new">In
contrast
to
JSON,
in
JSON-LD
the
keys
in
an
object
must
be
unique.
</ins>
</dd>
<dt>
<dfn id="dfn-array" title="array">
array
</dfn>
</dt>
<dd>
An
array
structure
is
represented
as
square
brackets
surrounding
zero
or
more
values
(or
elements).
Elements
are
separated
by
commas.
In
JSON,
an
array
is
an
<em>
ordered
</em>
sequence
of
zero
or
more
values.
While
JSON-LD
uses
the
same
array
representation
as
JSON,
the
collection
is
<em>
unordered
</em>
by
default.
While
order
is
preserved
in
regular
JSON
arrays,
it
is
not
in
regular
JSON-LD
arrays
unless
specific
markup
is
provided
(see
<a href="#sets-and-lists">
</a>
).
</dd>
<dt>
<dfn id="dfn-string" title="string">
string
</dfn>
</dt>
<dd>
A
string
is
a
sequence
of
zero
or
more
Unicode
characters,
wrapped
in
double
quotes,
using
backslash
escapes
(if
necessary).
A
character
is
represented
as
a
single
character
string.
</dd>
<dt>
<dfn id="dfn-number" title="number">
number
</dfn>
</dt>
<dd>
A
number
is
similar
to
that
used
in
most
programming
languages,
except
that
the
octal
and
hexadecimal
formats
are
not
used
and
that
leading
zeros
are
not
allowed.
</dd>
<dt>
<dfn id="dfn-true" title="true">
true
</dfn>
and
<dfn id="dfn-false" title="false">
false
</dfn>
</dt>
<dd>
Values
that
are
used
to
express
one
of
two
possible
boolean
states.
</dd>
<dt>
<dfn id="dfn-null" title="null">
null
</dfn>
</dt>
<dd>
The
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>
value.
A
key-value
pair
in
the
<code>
@context
</code>
where
the
value,
or
the
<code>
@id
</code>
of
the
value,
is
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>
explicitly
decouples
a
term's
association
with
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>.
A
key-value
pair
in
the
body
of
a
JSON-LD
document
whose
value
is
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>
has
the
same
meaning
as
if
the
key-value
pair
was
not
defined.
If
<code>
@value
</code>,
<code>
@list
</code>,
or
<code>
@set
</code>
is
set
to
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>
in
expanded
form,
then
the
entire
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
is
ignored.
</dd>
</dl>
<p>
Furthermore,
the
following
terminology
is
used
throughout
this
document:
</p>
<dl>
<dt>
<dfn id="dfn-keyword" title="keyword">
keyword
</dfn>
</dt>
<dd>
A
JSON
key
that
is
specific
to
JSON-LD,
specified
in
the
JSON-LD
Syntax
specification
[
<cite>
<a href="#bib-JSON-LD" class="bibref">
JSON-LD
</a>
</cite>
]
in
the
section
titled
<cite>
<a href="../json-ld/#syntax-tokens-and-keywords">
Syntax
Tokens
and
Keywords
</a>
</cite>.
</dd>
<dt>
<dfn id="dfn-context" title="context">
context
</dfn>
</dt>
<dd>
A
a
set
of
rules
for
interpreting
a
JSON-LD
document
as
specified
in
<cite>
<a href="../json-ld/#the-context">
The
Context
</a>
</cite>
of
the
[
<cite>
<a href="#bib-JSON-LD" class="bibref">
JSON-LD
</a>
</cite>
]
specification.
</dd>
<dt>
<dfn id="dfn-json-ld-document" title="json-ld-document">
JSON-LD
document
</dfn>
</dt>
<dd>
A
<a href="#dfn-json-ld-document" title="json-ld-document" class="tref internalDFN">
JSON-LD
document
</a>
is
a
serialization
of
a
collection
of
<a href="#dfn-json-ld-graph" title="json-ld-graph" class="tref internalDFN">
JSON-LD
graphs
</a>
and
comprises
exactly
one
<a href="#dfn-default-graph" title="default-graph" class="tref internalDFN">
default
graph
</a>
and
zero
or
more
<a href="#dfn-named-graph" title="named-graph" class="tref internalDFN">
named
graphs
</a>.
</dd>
<dt>
<dfn id="dfn-named-graph" title="named-graph">
named
graph
</dfn>
</dt>
<dd>
A
named
graph
is
a
pair
consisting
of
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
or
<a href="#dfn-blank-node" title="blank-node" class="tref internalDFN">
blank
node
</a>
(the
<dfn id="dfn-graph-name" title="graph-name">
graph
name
</dfn>
)
and
a
<a href="#dfn-json-ld-graph" title="json-ld-graph" class="tref internalDFN">
JSON-LD
graph
</a>.
</dd>
<dt>
<dfn id="dfn-default-graph" title="default-graph">
default
graph
</dfn>
</dt>
<dd>
The
default
graph
is
the
only
graph
in
a
JSON-LD
document
which
has
no
<a href="#dfn-graph-name" title="graph-name" class="tref internalDFN">
graph
name
</a>.
</dd>
<dt>
<dfn id="dfn-json-ld-graph" title="json-ld-graph">
JSON-LD
graph
</dfn>
</dt>
<dd>
A
labeled
directed
graph,
i.e.,
a
set
of
<a href="#dfn-node" title="node" class="tref internalDFN">
nodes
</a>
connected
by
<a href="#dfn-edge" title="edge" class="tref internalDFN">
edges
</a>,
as
specified
in
the
<cite>
<a href="../json-ld/#data-model">
Data
Model
</a>
</cite>
section
of
the
JSON-LD
syntax
specification
[
<cite>
<a href="#bib-JSON-LD" class="bibref">
JSON-LD
</a>
</cite>
].
</dd>
<dt>
<dfn id="dfn-edge" title="edge">
edge
</dfn>
</dt>
<dd>
Every
<a href="#dfn-edge" title="edge" class="tref internalDFN">
edge
</a>
has
a
direction
associated
with
it
and
is
labeled
with
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
or
a
<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
identifier
</a>.
Within
the
JSON-LD
syntax
these
edge
labels
are
called
<dfn id="dfn-property" title="property">
properties
</dfn>.
Whenever
possible,
an
<a href="#dfn-edge" title="edge" class="tref internalDFN">
edge
</a>
should
be
labeled
with
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</dd>
<dt>
<dfn id="dfn-node" title="node">
node
</dfn>
</dt>
<dd>
Every
<a href="#dfn-node" title="node" class="tref internalDFN">
node
</a>
is
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>,
a
<a href="#dfn-blank-node" title="blank-node" class="tref internalDFN">
blank
node
</a>,
a
<a href="#dfn-json-ld-value" title="json-ld-value" class="tref internalDFN">
JSON-LD
value
</a>,
or
a
<a href="#dfn-list" title="list" class="tref internalDFN">
list
</a>.
</dd>
<dt>
<dfn id="dfn-iri" title="iri">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</dfn>
</dt>
<dd>
An
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
(Internationalized
Resource
Identifier)
is
a
string
that
conforms
to
the
syntax
defined
in
[
<cite>
<a href="#bib-RFC3987" class="bibref">
RFC3987
</a>
</cite>
].
</dd>
<dt>
<dfn id="dfn-absolute-iri" title="absolute-iri">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</dfn>
</dt>
<dd>
An
absolute
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
is
defined
in
[
<cite>
<a href="#bib-RFC3987" class="bibref">
RFC3987
</a>
</cite>
]
containing
a
<em>
scheme
</em>
along
with
a
<em>
path
</em>
and
optional
<em>
query
</em>
and
fragment
segments.
</dd>
<dt>
<dfn id="dfn-relative-iri" title="relative-iri">
relative
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</dfn>
</dt>
<dd>
A
relative
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
is
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
that
is
relative
some
other
<a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
;
in
the
case
of
JSON-LD
this
is
the
base
location
of
the
document.
</dd>
<dt>
<dfn id="dfn-blank-node" title="blank-node">
blank
node
</dfn>
</dt>
<dd>
A
<a href="#dfn-node" title="node" class="tref internalDFN">
node
</a>
in
a
<a href="#dfn-json-ld-graph" title="json-ld-graph" class="tref internalDFN">
JSON-LD
graph
</a>
that
does
not
contain
a
de-referenceable
identifier
because
it
is
either
ephemeral
in
nature
or
does
not
contain
information
that
needs
to
be
linked
to
from
outside
of
the
JSON-LD
graph.
</dd>
<dt>
<dfn id="dfn-blank-node-identifier" title="blank-node-identifier">
blank
node
identifier
</dfn>
</dt>
<dd>
A
blank
node
identifier
is
a
string
that
can
be
used
as
an
identifier
for
a
<a href="#dfn-blank-node" title="blank-node" class="tref internalDFN">
blank
node
</a>
within
the
scope
of
a
JSON-LD
document.
Blank
node
identifiers
begin
with
<code>
_:
</code>.
</dd>
<dt>
<dfn id="dfn-json-ld-value" title="json-ld-value">
JSON-LD
value
</dfn>
</dt>
<dd>
A
<a href="#dfn-json-ld-value" title="json-ld-value" class="tref internalDFN">
JSON-LD
value
</a>
is
a
<a href="#dfn-string" title="string" class="tref internalDFN">
string
</a>,
a
<a href="#dfn-number" title="number" class="tref internalDFN">
number
</a>,
<a href="#dfn-true" title="true" class="tref internalDFN">
true
</a>
or
<a href="#dfn-false" title="false" class="tref internalDFN">
false
</a>,
a
<a href="#dfn-typed-value" title="typed-value" class="tref internalDFN">
typed
value
</a>,
or
a
<a href="#dfn-language-tagged-string" title="language-tagged-string" class="tref internalDFN">
language-tagged
string
</a>.
</dd>
<dt>
<dfn id="dfn-typed-value" title="typed-value">
typed
value
</dfn>
</dt>
<dd>
A
<a href="#dfn-typed-value" title="typed-value" class="tref internalDFN">
typed
value
</a>
consists
of
a
value,
which
is
a
string,
and
a
type,
which
is
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</dd>
<dt>
<dfn id="dfn-language-tagged-string" title="language-tagged-string">
language-tagged
string
</dfn>
</dt>
<dd>
A
<a href="#dfn-language-tagged-string" title="language-tagged-string" class="tref internalDFN">
language-tagged
string
</a>
consists
of
a
string
and
a
non-empty
language
tag
as
defined
by
[
<cite>
<a href="#bib-BCP47" class="bibref">
BCP47
</a>
</cite>
].
The
language
tag
must
be
well-formed
according
to
<del class="diff-old">section
</del>
<a href="http://tools.ietf.org/html/bcp47#section-2.2.9">
<ins class="diff-new">section
</ins>
2.2.9
</a>
of
[
<cite>
<a href="#bib-BCP47" class="bibref">
BCP47
</a>
</cite>
],
and
<del class="diff-old">must
be
</del>
<ins class="diff-chg">is
</ins>
normalized
to
lowercase.
</dd>
<dt>
<dfn id="dfn-list" title="list">
list
</dfn>
</dt>
<dd>
A
<a href="#dfn-list" title="list" class="tref internalDFN">
list
</a>
is
an
ordered
sequence
of
<a href="#dfn-iri" title="iri" class="tref internalDFN">
IRIs
</a>,
<a href="#dfn-blank-node" title="blank-node" class="tref internalDFN">
blank
nodes
</a>,
and
<a href="#dfn-json-ld-value" title="json-ld-value" class="tref internalDFN">
JSON-LD
values
</a>.
</dd>
</dl>
</section>
<section id="algorithm-terms">
<h2>
<span class="secno">
5.
</span>
<del class="diff-old">Algorithms
All
algorithms
described
in
this
section
are
intended
to
operate
on
language-native
data
structures.
That
is,
the
serialization
to
a
text-based
JSON
document
isn't
required
as
input
or
output
to
any
of
these
algorithms
and
language-native
data
structures
must
be
used
where
applicable.
5.1
</del>
Algorithm
Terms
</h2>
<dl>
<dt>
<dfn id="dfn-active-graph" title="active-graph">
active
graph
</dfn>
</dt>
<dd>
The
name
of
the
currently
active
graph
that
the
processor
should
use
when
processing.
</dd>
<dt>
<dfn id="dfn-active-subject" title="active-subject">
active
subject
</dfn>
</dt>
<dd>
The
currently
active
subject
that
the
processor
should
use
when
processing.
</dd>
<dt>
<dfn id="dfn-active-property" title="active-property">
active
property
</dfn>
</dt>
<dd>
The
currently
active
<a href="#dfn-property" title="property" class="tref internalDFN">
property
<del class="diff-old">that
the
processor
should
use
when
processing.
The
active
property
is
represented
in
the
original
lexical
form,
which
is
used
for
finding
type
mappings
in
the
active
context
.
active
object
The
currently
active
object
</del>
</a>
<ins class="diff-chg">or
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keyword
</ins></a>
that
the
processor
should
use
when
processing.
</dd>
<dt>
<dfn id="dfn-active-context" title="active-context">
active
context
</dfn>
</dt>
<dd>
A
context
that
is
used
to
resolve
<del class="diff-old">term
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">terms
</ins>
</a>
<del class="diff-old">s
</del>
while
the
processing
algorithm
is
running.
<del class="diff-old">The
active
context
is
the
context
contained
within
the
processor
state
.
</del>
</dd>
<dt>
<dfn id="dfn-local-context" title="local-context">
local
context
</dfn>
</dt>
<dd>
A
context
that
is
specified
within
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>,
specified
via
the
<code>
@context
</code>
<a href="#dfn-keyword" title="keyword" class="tref internalDFN">
keyword
</a>.
</dd>
<dt>
<del class="diff-old">processor
state
The
processor
state
,
which
includes
the
active
context
,
active
subject
,
and
active
property
.
The
processor
state
is
managed
as
a
stack
with
elements
from
the
previous
processor
state
copied
into
a
new
processor
state
when
entering
a
new
JSON
object
.
</del>
<dfn id="dfn-json-ld-input" title="json-ld-input">
JSON-LD
input
</dfn>
</dt>
<dd>
The
JSON-LD
data
structure
that
is
provided
as
input
to
the
algorithm.
</dd>
<dt>
<del class="diff-old">JSON-LD
output
The
JSON-LD
data
structure
that
is
produced
as
output
by
the
algorithm.
</del>
<dfn id="dfn-term" title="term">
term
</dfn>
</dt>
<dd>
A
<a href="#dfn-term" title="term" class="tref internalDFN">
term
</a>
is
a
short
word
defined
in
a
context
that
may
be
expanded
to
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
</dd>
<dt>
<dfn id="dfn-compact-iri" title="compact-iri">
compact
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</dfn>
</dt>
<dd>
A
compact
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
is
has
the
form
of
<dfn id="dfn-prefix" title="prefix">
prefix
</dfn>:
<em>
suffix
</em>
and
is
used
as
a
way
of
expressing
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
without
needing
to
define
separate
<a href="#dfn-term" title="term" class="tref internalDFN">
term
</a>
definitions
for
each
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
contained
within
a
common
vocabulary
identified
by
<a href="#dfn-prefix" title="prefix" class="tref internalDFN">
prefix
</a>.
</dd>
<dt>
<dfn id="dfn-node-object" title="node-object">
node
object
</dfn>
</dt>
<dd>
A
<a href="#dfn-node-object" title="node-object" class="tref internalDFN">
node
object
</a>
represents
zero
or
more
properties
of
a
<a href="#dfn-node" title="node" class="tref internalDFN">
node
</a>
in
the
<a href="#dfn-json-ld-graph" title="json-ld-graph" class="tref internalDFN">
JSON-LD
graph
</a>
serialized
by
the
JSON-LD
document.
A
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
is
a
<a href="#dfn-node-object" title="node-object" class="tref internalDFN">
node
object
</a>
if
it
exists
outside
of
the
JSON-LD
<a href="#dfn-context" title="context" class="tref internalDFN">
context
</a>
and:
<ul>
<li>
it
does
not
contain
the
<code>
@value
</code>,
<code>
@list
</code>,
or
<code>
@set
</code>
keywords,
or
</li>
<li>
it
is
not
the
<del class="diff-old">top-level
</del>
<ins class="diff-chg">top-most
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
in
the
JSON-LD
document
<del class="diff-old">containing
the
</del>
<ins class="diff-chg">consisting
of
no
other
members
than
</ins>
<code>
@graph
</code>
<del class="diff-old">keyword.
</del>
<ins class="diff-chg">and
</ins><code><ins class="diff-chg">
@context
</ins></code>.
</li>
</ul>
</dd>
<dt>
<dfn id="dfn-value-object" title="value-object">
<ins class="diff-chg">value
object
</ins></dfn></dt><dd><ins class="diff-chg">
A
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN"><ins class="diff-chg">
value
object
</ins></a><ins class="diff-chg">
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
that
has
an
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member.
</ins></dd><dt><dfn id="dfn-list-object" title="list-object">
list
object
</dfn>
</dt>
<dd>
A
<a href="#dfn-list-object" title="list-object" class="tref internalDFN">
list
object
</a>
is
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
that
has
<del class="diff-old">a
</del>
<ins class="diff-chg">an
</ins>
<code>
@list
</code>
member.
</dd>
<dt>
<dfn id="dfn-set-object" title="set-object">
<ins class="diff-chg">set
object
</ins></dfn></dt><dd><ins class="diff-chg">
A
</ins><a href="#dfn-set-object" title="set-object" class="tref internalDFN"><ins class="diff-chg">
set
object
</ins></a><ins class="diff-chg">
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
that
has
an
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
member.
</ins></dd><dt><dfn id="dfn-scalar" title="scalar">
scalar
</dfn>
</dt>
<dd>
A
scalar
is
either
a
JSON
<a href="#dfn-string" title="string" class="tref internalDFN">
string
</a>,
<a href="#dfn-number" title="number" class="tref internalDFN">
number
</a>,
<a href="#dfn-true" title="true" class="tref internalDFN">
true
</a>,
or
<a href="#dfn-false" title="false" class="tref internalDFN">
false
</a>.
</dd>
<dt>
<del class="diff-old">quad
</del>
<dfn id="dfn-rdf-subject" title="rdf-subject">
<ins class="diff-chg">RDF
subject
</ins></dfn></dt><dd><ins class="diff-chg">
A
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-subject" title="subject" class="tref externalDFN"><ins class="diff-chg">
subject
</ins></a><ins class="diff-chg">
as
specified
by
[
</ins><cite><a href="#bib-RDF11-CONCEPTS" class="bibref"><ins class="diff-chg">
RDF11-CONCEPTS
</ins></a></cite><ins class="diff-chg">
].
</ins></dd><dt><dfn id="dfn-rdf-predicate" title="rdf-predicate"><ins class="diff-chg">
RDF
predicate
</ins></dfn></dt><dd><ins class="diff-chg">
A
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-predicate" title="predicate" class="tref externalDFN"><ins class="diff-chg">
predicate
</ins></a><ins class="diff-chg">
as
specified
by
[
</ins><cite><a href="#bib-RDF11-CONCEPTS" class="bibref"><ins class="diff-chg">
RDF11-CONCEPTS
</ins></a></cite><ins class="diff-chg">
].
</ins></dd><dt><dfn id="dfn-rdf-object" title="rdf-object"><ins class="diff-chg">
RDF
object
</ins>
</dfn>
</dt>
<dd>
An
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-object" title="object" class="tref externalDFN">
<ins class="diff-chg">object
</ins></a><ins class="diff-chg">
as
specified
by
[
</ins><cite><a href="#bib-RDF11-CONCEPTS" class="bibref"><ins class="diff-chg">
RDF11-CONCEPTS
</ins></a></cite><ins class="diff-chg">
].
</ins></dd><dt><dfn id="dfn-rdf-triple" title="rdf-triple">
RDF
triple
</dfn>
</dt>
<dd>
<ins class="diff-chg">A
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref externalDFN"><ins class="diff-chg">
triple
</ins></a>
as
specified
by
[
<cite>
<del class="diff-old">RDF-CONCEPTS
</del>
<a href="#bib-RDF11-CONCEPTS" class="bibref">
<ins class="diff-chg">RDF11-CONCEPTS
</ins></a></cite><ins class="diff-chg">
].
</ins></dd><dt><dfn id="dfn-rdf-dataset" title="rdf-dataset"><ins class="diff-chg">
RDF
dataset
</ins></dfn></dt><dd><ins class="diff-chg">
A
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset" title="dataset" class="tref externalDFN"><ins class="diff-chg">
dataset
</ins></a><ins class="diff-chg">
as
specified
by
[
</ins><cite><a href="#bib-RDF11-CONCEPTS" class="bibref"><ins class="diff-chg">
RDF11-CONCEPTS
</ins>
</a>
</cite>
]
<del class="diff-old">augmented
with
a
a
fourth
component,
</del>
<ins class="diff-chg">representing
</ins>
a
<del class="diff-old">graph
name
</del>
<ins class="diff-chg">collection
of
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-graph" title="rdf-graphs" class="tref externalDFN"><ins class="diff-chg">
RDF
graphs
</ins>
</a>.
</dd>
</dl>
</section>
<section id="context-processing-algorithms">
<h2>
<span class="secno">
<ins class="diff-chg">6.
</ins></span><ins class="diff-chg">
Context
Processing
Algorithms
</ins></h2><section id="context-processing-algorithm">
<h3>
<span class="secno">
<del class="diff-old">5.2
</del>
<ins class="diff-chg">6.1
</ins>
</span>
<del class="diff-old">Expansion
</del>
<ins class="diff-chg">Context
Processing
</ins>
Algorithm
</h3>
<p>
<del class="diff-old">The
algorithm
takes
three
input
variables:
an
</del>
<ins class="diff-chg">When
processing
a
JSON-LD
data
structure,
each
processing
rule
is
applied
using
information
provided
by
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
<del class="diff-old">,
</del>
</a>.
<ins class="diff-chg">This
section
describes
how
to
produce
</ins>
an
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
<del class="diff-old">property
,
and
an
element
to
be
expanded.
To
begin,
the
</del>
<ins class="diff-chg">context
</ins></a>.</p><p><ins class="diff-chg">
The
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>
<del class="diff-old">is
set
to
</del>
<ins class="diff-chg">contains
</ins>
the
<del class="diff-old">result
of
performing,
Context
Processing
on
</del>
<ins class="diff-chg">active
</ins><dfn id="dfn-term-definition" title="term-definition"><ins class="diff-chg">
term
definitions
</ins></dfn><ins class="diff-chg">
which
specify
how
properties
and
values
have
to
be
interpreted
as
well
as
</ins>
the
<del class="diff-old">passed
</del>
<ins class="diff-chg">current
</ins><dfn id="dfn-base-iri" title="base-iri"><ins class="diff-chg">
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
<del class="diff-old">expandContext
</del>
</dfn>,
<ins class="diff-chg">the
</ins><dfn id="dfn-vocabulary-mapping" title="vocabulary-mapping"><ins class="diff-chg">
vocabulary
mapping
</ins></dfn><ins class="diff-chg">
and
the
</ins><dfn id="dfn-default-language" title="default-language"><ins class="diff-chg">
default
language
</ins></dfn>.<ins class="diff-chg">
Each
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins>
</a>
<ins class="diff-new">consists
of
an
</ins><dfn id="dfn-iri-mapping" title="iri-mapping">
<del class="diff-old">,
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></dfn>,<ins class="diff-chg">
a
boolean
flag
</ins><dfn id="dfn-reverse-property" title="reverse-property"><ins class="diff-chg">
reverse
property
</ins></dfn>,<ins class="diff-chg">
an
optional
</ins><dfn id="dfn-type-mapping" title="type-mapping"><ins class="diff-chg">
type
mapping
</ins></dfn>
or
<del class="diff-old">empty
if
expandContext
</del>
<dfn id="dfn-language-mapping" title="language-mapping">
<ins class="diff-chg">language
mapping
</ins></dfn>,<ins class="diff-chg">
and
an
optional
</ins><dfn id="dfn-container-mapping" title="container-mapping"><ins class="diff-chg">
container
mapping
</ins></dfn>.<ins class="diff-chg">
A
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins>
</a>
<ins class="diff-chg">can
not
only
be
used
to
map
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
to
an
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>,<ins class="diff-chg">
but
also
to
map
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
to
a
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keyword
</ins></a>,<ins class="diff-chg">
in
which
case
it
</ins>
is
<del class="diff-old">null
</del>
<ins class="diff-chg">referred
to
as
a
</ins><dfn id="dfn-keyword-alias" title="keyword-alias"><ins class="diff-chg">
keyword
alias
</ins></dfn>.</p><p><ins class="diff-chg">
When
processing,
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
is
initialized
without
any
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definitions
</ins>
</a>,
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
<ins class="diff-chg">vocabulary
mapping
</ins></a>,<ins class="diff-chg">
or
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins></a>.<ins class="diff-chg">
If
a
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
is
encountered
during
processing,
a
new
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
<del class="diff-old">property
</del>
<ins class="diff-chg">context
</ins>
</a>
is
<del class="diff-old">set
</del>
<ins class="diff-chg">created
by
cloning
the
existing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>.<ins class="diff-chg">
Then
the
information
from
the
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
is
merged
into
the
new
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>.<ins class="diff-chg">
Given
that
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
contexts
</ins></a><ins class="diff-chg">
may
contain
references
</ins>
to
<del class="diff-old">null
,
and
</del>
<ins class="diff-chg">remote
contexts,
this
includes
their
retrieval.
</ins></p><section class="informative"><h4 id="general-solution"><ins class="diff-chg">
General
Solution
</ins></h4><p>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">This
section
</ins>
is
<del class="diff-old">set
to
</del>
<ins class="diff-chg">non-normative.
</ins></em></p><p><ins class="diff-chg">
First
we
prepare
a
new
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
by
cloning
</ins>
the
<del class="diff-old">JSON-LD
input
</del>
<ins class="diff-chg">current
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins>
</a>.
<del class="diff-old">This
algorithm
expects
</del>
<ins class="diff-chg">Then
we
normalize
</ins>
the
<del class="diff-old">JSON-LD
input
</del>
<ins class="diff-chg">form
the
passed
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins>
</a>
to
<ins class="diff-new">an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>.<a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-new">
Local
contexts
</ins></a><ins class="diff-new">
may
</ins>
be
<ins class="diff-new">in
the
form
of
</ins>
a
<del class="diff-old">well-formed
JSON-LD
document
as
defined
</del>
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
<ins class="diff-chg">JSON
object
</ins></a>,<ins class="diff-chg">
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
or
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
containing
a
combination
of
the
two.
Finally
we
process
each
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a><ins class="diff-chg">
contained
</ins>
in
<del class="diff-old">[
JSON-LD
</del>
<ins class="diff-chg">the
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins>
</a>
<del class="diff-old">].
</del>
<a href="#dfn-array" title="array" class="tref internalDFN">
<ins class="diff-chg">array
</ins></a><ins class="diff-chg">
as
follows.
</ins>
</p>
<p>
If
<del class="diff-old">element
</del>
<a href="#dfn-context" title="context" class="tref internalDFN">
<ins class="diff-chg">context
</ins></a>
is
a
<del class="diff-old">scalar
</del>
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins>
</a>,
<del class="diff-old">expand
</del>
it
<del class="diff-old">according
</del>
<ins class="diff-chg">represents
a
reference
</ins>
to
<ins class="diff-new">a
remote
context.
We
dereference
</ins>
the
<del class="diff-old">Value
Expansion
</del>
<ins class="diff-chg">remote
context
and
replace
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins>
</a>
<del class="diff-old">algorithm,
passing
copies
</del>
<ins class="diff-chg">with
the
value
</ins>
of
the
<del class="diff-old">active
</del>
<code>
<ins class="diff-chg">@context
</ins></code><ins class="diff-chg">
key
of
the
top-level
object
in
the
retrieved
JSON-LD
document.
If
there's
no
such
key,
an
invalid
remote
context
has
been
detected.
Otherwise,
we
process
</ins><a href="#dfn-context" title="context" class="tref internalDFN">
context
</a>
<ins class="diff-new">by
recursively
using
this
algorithm
ensuring
that
there
is
no
cyclical
reference.
</ins></p><p><ins class="diff-new">
If
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-new">
context
</ins></a><ins class="diff-new">
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a>,<ins class="diff-new">
we
first
update
the
</ins><a href="#dfn-base-iri" title="base-iri" class="tref internalDFN"><ins class="diff-new">
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>,<ins class="diff-new">
the
</ins><a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN"><ins class="diff-new">
vocabulary
mapping
</ins></a>,
and
<del class="diff-old">active
property
</del>
<ins class="diff-chg">the
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins>
</a>
<ins class="diff-new">by
processing
three
specific
keywords:
</ins><code><ins class="diff-new">
@base
</ins></code>,<code><ins class="diff-new">
@vocab
</ins></code>,
and
<del class="diff-old">return.
If
element
is
null
</del>
<code>
<ins class="diff-chg">@language
</ins></code>.<ins class="diff-chg">
These
are
handled
before
any
other
keys
in
the
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
because
they
affect
how
the
other
keys
are
processed.
</ins></p><p><ins class="diff-chg">
Then,
for
every
other
key
in
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins>
</a>,
<del class="diff-old">return.
If
element
</del>
<ins class="diff-chg">we
update
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
result
</ins></i>.<ins class="diff-chg">
Since
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definitions
</ins></a><ins class="diff-chg">
in
a
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
may
themselves
contain
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-chg">
compact
IRIs
</ins></a>,<ins class="diff-chg">
we
may
need
to
recurse.
When
doing
so,
we
must
ensure
that
there
is
no
cyclical
dependency,
which
</ins>
is
an
<del class="diff-old">array
</del>
<ins class="diff-chg">error.
After
we
have
processed
any
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
dependencies,
we
update
the
current
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins>
</a>,
<del class="diff-old">initialize
an
empty
array
</del>
<ins class="diff-chg">which
may
be
a
</ins><a href="#dfn-keyword-alias" title="keyword-alias" class="tref internalDFN"><ins class="diff-chg">
keyword
alias
</ins></a>.</p><p><ins class="diff-chg">
Finally,
we
return
</ins><i>
result
<del class="diff-old">.
Expand
each
item
by
recursively
using
this
algorithm,
passing
copies
of
</del>
</i>
<ins class="diff-chg">as
</ins>
the
<ins class="diff-chg">new
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
<del class="diff-old">and
active
property
</del>
</a>.
<del class="diff-old">If
the
</del>
</p>
</section>
<section>
<h4 id="algorithm">
<ins class="diff-chg">Algorithm
</ins></h4><p><ins class="diff-chg">
This
algorithm
specifies
how
a
new
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
<del class="diff-old">property's
container
mapping
</del>
<ins class="diff-chg">context
</ins>
</a>
is
<del class="diff-old">set
to
@list
</del>
<ins class="diff-chg">updated
with
a
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>.<ins class="diff-chg">
The
algorithm
takes
three
input
variables:
an
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
a
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>,
and
<del class="diff-old">the
expanded
item
is
</del>
an
<a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>
<del class="diff-old">or
a
list
object
trigger
a
LIST_OF_LISTS_DETECTED
error.
</del>
<i>
<ins class="diff-chg">remote
contexts
</ins></i><ins class="diff-chg">
which
is
used
to
detect
cyclical
context
inclusions.
</ins>
If
<del class="diff-old">the
expanded
item
</del>
<i>
<ins class="diff-chg">remote
contexts
</ins></i>
is
<del class="diff-old">null
,
drop
it.
Otherwise,
if
the
expanded
item
</del>
<ins class="diff-chg">not
passed,
it
</ins>
is
<ins class="diff-new">initialized
to
</ins>
an
<ins class="diff-chg">empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">,
merge
its
entries
with
result's
entries.
</del>
</a>.
</p>
<ol class="algorithm">
<li>
<del class="diff-old">Otherwise,
append
item
to
</del>
<ins class="diff-chg">Initialize
</ins><i>
result
<del class="diff-old">.
Finally,
set
element
</del>
</i>
to
<ins class="diff-chg">the
</ins>
result
<del class="diff-old">and
return.
</del>
<ins class="diff-chg">of
cloning
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
element
must
be
an
object.
</del>
If
<del class="diff-old">element
has
a
@context
member,
update
the
active
</del>
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
<ins class="diff-chg">local
</ins>
context
</a>
<del class="diff-old">according
</del>
<ins class="diff-chg">is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
set
it
</ins>
to
<del class="diff-old">the
steps
outlined
in
Context
Processing
and
remove
the
@context
member.
Initialize
</del>
an
<del class="diff-old">empty
JSON
object
</del>
<a href="#dfn-array" title="array" class="tref internalDFN">
<ins class="diff-chg">array
</ins>
</a>
<del class="diff-old">result
and
</del>
<ins class="diff-chg">containing
only
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>.
</li>
<li>
<del class="diff-old">then
process
</del>
<ins class="diff-chg">For
</ins>
each
<del class="diff-old">property
and
value
</del>
<ins class="diff-chg">item
</ins><i><ins class="diff-chg">
context
</ins></i>
in
<del class="diff-old">element
ordered
by
property
as
follows:
</del>
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
<ins class="diff-chg">local
context
</ins></a>:
<ol class="algorithm">
<li>
If
<del class="diff-old">the
active
</del>
<i>
context
<del class="diff-old">contains
a
property
generator
for
property
set
expanded
property
to
its
IRIs
</del>
</i>
<ins class="diff-chg">is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins>
</a>,
<del class="diff-old">otherwise
</del>
set
<del class="diff-old">it
to
the
</del>
<i>
result
<del class="diff-old">of
expanding
property
according
</del>
</i>
to
<del class="diff-old">the
steps
outlined
in
IRI
Expansion
</del>
<ins class="diff-chg">a
newly-initialized
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins>
</a>
<del class="diff-old">(passing
true
for
the
vocabRelative
flag).
If
expanded
property
is
null
,
skip
the
current
property
-
value
pair
</del>
and
continue
<del class="diff-old">to
</del>
<ins class="diff-chg">with
</ins>
the
next
<del class="diff-old">property
-
value
pair
in
element
.
</del>
<i>
<ins class="diff-chg">context
</ins></i>.
</li>
<li>
If
<del class="diff-old">expanded
property
</del>
<i>
<ins class="diff-chg">context
</ins></i>
is
a
<del class="diff-old">keyword
</del>
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins>
</a>,
<del class="diff-old">process
it
as
follows:
</del>
<ol class="algorithm">
<li>
<del class="diff-old">If
expanded
property
equals
@id
,
set
the
@id
member
of
result
</del>
<ins class="diff-chg">Set
</ins><i><ins class="diff-chg">
context
</ins></i>
to
the
result
of
<del class="diff-old">expanding
</del>
<ins class="diff-chg">resolving
</ins><i>
value
<del class="diff-old">according
</del>
</i>
<ins class="diff-chg">against
</ins>
the
<ins class="diff-chg">base
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
algorithm
(passing
true
for
the
documentRelative
flag).
If
value
</del>
<ins class="diff-chg">which
</ins>
is
<del class="diff-old">not
</del>
<ins class="diff-chg">established
as
specified
in
</ins><cite><a href="http://tools.ietf.org/html/rfc3986#section-5.1"><ins class="diff-chg">
section
5.1
Establishing
</ins>
a
<del class="diff-old">string
</del>
<ins class="diff-chg">Base
URI
</ins>
</a>
<del class="diff-old">trigger
an
INVALID_ID_VALUE
error.
If
expanded
property
equals
@type
,
set
the
@type
member
</del>
</cite>
of
<del class="diff-old">result
to
</del>
<ins class="diff-chg">[
</ins><cite><a href="#bib-RFC3986" class="bibref"><ins class="diff-chg">
RFC3986
</ins></a></cite><ins class="diff-chg">
].
Only
</ins>
the
<del class="diff-old">result
</del>
<ins class="diff-chg">basic
algorithm
in
</ins><cite><a href="http://tools.ietf.org/html/rfc3986#section-5.2"><ins class="diff-chg">
section
5.2
</ins></a></cite>
of
<del class="diff-old">expanding
value
according
the
</del>
<ins class="diff-chg">[
</ins><cite>
<del class="diff-old">IRI
Expansion
algorithm
</del>
<a href="#bib-RFC3986" class="bibref">
<ins class="diff-chg">RFC3986
</ins>
</a>
<del class="diff-old">(passing
true
for
both
the
documentRelative
and
the
vocabRelative
flag).
If
value
</del>
</cite>
<ins class="diff-chg">]
</ins>
is
<ins class="diff-new">used;
</ins>
neither
<del class="diff-old">a
string
</del>
<cite>
<a href="http://tools.ietf.org/html/rfc3986#section-6.2.2">
<ins class="diff-chg">Syntax-Based
Normalization
</ins>
</a>
</cite>
nor
<del class="diff-old">an
array
</del>
<cite>
<a href="http://tools.ietf.org/html/rfc3986#section-6.2.3">
<ins class="diff-chg">Scheme-Based
Normalization
</ins>
</a>
<del class="diff-old">of
strings
</del>
</cite>
<ins class="diff-chg">are
performed.
Characters
additionally
allowed
in
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
references
are
treated
in
the
same
way
that
unreserved
characters
are
treated
in
URI
references,
per
</ins><cite><a href="http://tools.ietf.org/html/rfc3987#section-6.5"><ins class="diff-chg">
section
6.5
</ins>
</a>
<del class="diff-old">trigger
an
INVALID_TYPE_VALUE
error.
Empty
arrays
</del>
</cite>
<ins class="diff-chg">of
[
</ins><cite><a href="#bib-RFC3987" class="bibref"><ins class="diff-chg">
RFC3987
</ins>
</a>
<del class="diff-old">are
ignored.
</del>
</cite>
<ins class="diff-chg">].
</ins>
</li>
<li>
If
<del class="diff-old">expanded
property
equals
@value
,
set
the
@value
member
of
result
to
value
.
If
value
</del>
<i>
<ins class="diff-chg">context
</ins></i>
is
<del class="diff-old">neither
</del>
<ins class="diff-chg">in
the
</ins><i><ins class="diff-chg">
remote
contexts
</ins></i><ins class="diff-chg">
array,
</ins>
a
<del class="diff-old">scalar
nor
null
trigger
an
</del>
<code class="error">
<del class="diff-old">INVALID_VALUE_OBJECT_VALUE
</del>
<a href="#idl-def-JsonLdErrorCode.recursive-context-inclusion">
<ins class="diff-chg">recursive
context
inclusion
</ins></a>
</code>
<del class="diff-old">error.
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted;
otherwise,
add
</ins><i><ins class="diff-chg">
context
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
remote
contexts
</ins></i>.
</li>
<li>
<del class="diff-old">If
expanded
property
equals
@language
,
set
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
context
no
base
</ins></i><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">@language
member
of
</del>
result
<del class="diff-old">to
</del>
<ins class="diff-chg">of
cloning
</ins>
the
<del class="diff-old">lowercased
value
.
If
value
is
not
a
string
,
trigger
an
INVALID_LANGUAGE_VALUE
error.
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-chg">active
context
</ins></a>.
</li>
<li>
<del class="diff-old">If
expanded
property
equals
@annotation
,
set
</del>
<ins class="diff-chg">Remove
</ins>
the
<del class="diff-old">@annotation
member
of
result
to
value
.
If
value
is
not
a
string
</del>
<a href="#dfn-base-iri" title="base-iri" class="tref internalDFN">
<ins class="diff-chg">base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>
<del class="diff-old">trigger
an
INVALID_ANNOTATION_VALUE
error.
</del>
<ins class="diff-chg">of
</ins><i><ins class="diff-chg">
context
no
base
</ins></i>.
</li>
<li>
<ins class="diff-new">Dereference
</ins><i><ins class="diff-new">
context
</ins></i>.
If
<del class="diff-old">expanded
property
equals
</del>
<ins class="diff-chg">the
dereferenced
document
has
no
top-level
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
with
an
</ins>
<code>
<del class="diff-old">@set
</del>
<ins class="diff-chg">@context
</ins>
</code>
<del class="diff-old">or
@list
,
</del>
<ins class="diff-chg">member,
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-remote-context"><ins class="diff-chg">
invalid
remote
context
</ins></a></code><ins class="diff-chg">
has
been
detected
and
processing
is
aborted;
otherwise,
</ins>
set
<i>
<ins class="diff-new">context
</ins></i><ins class="diff-new">
to
</ins>
the
<del class="diff-old">expanded
property
member
</del>
<ins class="diff-chg">value
</ins>
of
<del class="diff-old">result
</del>
<ins class="diff-chg">that
member.
</ins></li><li><ins class="diff-chg">
Set
</ins><i><ins class="diff-chg">
context
</ins></i>
to
the
result
of
<del class="diff-old">expanding
value
by
</del>
recursively
<del class="diff-old">using
</del>
<ins class="diff-chg">calling
</ins>
this
algorithm,
passing
<del class="diff-old">copies
of
the
</del>
<i>
<ins class="diff-chg">context
no
base
</ins></i><ins class="diff-chg">
for
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<i>
<ins class="diff-chg">context
</ins></i><ins class="diff-chg">
for
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>,
and
<del class="diff-old">active
property
.
</del>
<i>
<ins class="diff-chg">remote
contexts
</ins></i>.
</li>
<li>
If
<del class="diff-old">expanded
property
equals
@graph
,
</del>
<i>
<ins class="diff-chg">context
</ins></i><ins class="diff-chg">
has
no
</ins><a href="#dfn-base-iri" title="base-iri" class="tref internalDFN"><ins class="diff-chg">
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
but
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
does,
</ins>
set
the
<del class="diff-old">@graph
member
</del>
<a href="#dfn-base-iri" title="base-iri" class="tref internalDFN">
<ins class="diff-chg">base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>
of
<del class="diff-old">result
</del>
<i>
<ins class="diff-chg">context
</ins></i>
to
the
<del class="diff-old">result
of
expanding
value
by
recursively
using
this
algorithm,
passing
copies
</del>
<ins class="diff-chg">one
</ins>
of
<del class="diff-old">the
active
context
and
@graph
as
active
property
.
</del>
<i>
<ins class="diff-chg">result
</ins></i>.
</li>
<li>
<del class="diff-old">Continue
</del>
<ins class="diff-chg">Overwrite
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
with
</ins><i><ins class="diff-chg">
context
</ins></i><ins class="diff-chg">
and
continue
</ins>
with
the
next
<del class="diff-old">property
-
value
pair
from
element
.
</del>
<i>
<ins class="diff-chg">context
</ins></i>.
</li>
</ol>
</li>
<li>
If
<del class="diff-old">expanded
property
</del>
<i>
<ins class="diff-chg">context
</ins></i>
is
not
<ins class="diff-new">a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a>,
an
<del class="diff-old">absolute
IRI
</del>
<code class="error">
<del class="diff-old">,i.e.,
it
doesn't
contain
a
colon,
continue
with
the
next
member
from
element
.
Otherwise,
if
property's
container
mapping
</del>
<a href="#idl-def-JsonLdErrorCode.invalid-local-context">
<ins class="diff-chg">invalid
local
context
</ins>
</a>
<del class="diff-old">is
set
to
@language
</del>
</code>
<del class="diff-old">Initialize
a
new
empty
array
language
map
values
.
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins>
</li>
<li>
<del class="diff-old">Process
each
key
-
val
pair
of
value
ordered
by
key
as
follows:
</del>
If
<del class="diff-old">val
is
not
</del>
<i>
<ins class="diff-chg">context
</ins></i><ins class="diff-chg">
has
</ins>
an
<del class="diff-old">array,
transform
it
to
one.
For
each
item
of
val
,
construct
a
new
JSON
object
consisting
of
two
members:
</del>
<code>
<del class="diff-old">@value
</del>
<ins class="diff-chg">@base
</ins>
</code>
<del class="diff-old">set
to
</del>
<ins class="diff-chg">key:
</ins><div class="issue"><div class="issue-title"><a href="https://github.com/json-ld/json-ld.org/issues/223"><span><ins class="diff-chg">
Issue
223
</ins></span></a>:<ins class="diff-chg">
Feature
at
risk
</ins></div><p class="atrisk"><ins class="diff-chg">
This
feature
is
at
risk
as
</ins>
the
<del class="diff-old">currently
processed
item
and
</del>
<ins class="diff-chg">fact
that
a
document
may
have
multiple
base
IRIs
is
potentially
confusing
for
developers.
It
is
also
being
discussed
whether
relative
IRIs
are
allowed
as
values
of
</ins>
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@base
</ins>
</code>
<del class="diff-old">set
to
</del>
<ins class="diff-chg">or
whether
</ins>
the
<del class="diff-old">lowercased
key
.
If
val
is
not
a
</del>
<ins class="diff-chg">empty
</ins>
string
<del class="diff-old">,
trigger
a
LANGUAGE_MAP_INVALID_VALUE
error.
Otherwise
append
the
object
to
language
map
values
.
Set
value
</del>
<ins class="diff-chg">should
be
used
</ins>
to
<del class="diff-old">language
map
values
.
Otherwise,
if
property's
container
mapping
is
set
</del>
<ins class="diff-chg">explicitly
specify
that
there
isn't
a
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>,<ins class="diff-chg">
which
could
be
used
</ins>
to
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">ensure
that
relative
IRIs
remain
relative
when
expanding.
</ins></p></div>
<ol class="algorithm">
<li>
Initialize
<del class="diff-old">a
new
empty
array
annotation
map
values
.
Process
each
key
-
val
pair
of
</del>
<i>
value
<del class="diff-old">ordered
by
key
as
follows:
If
val
is
not
an
array,
transform
it
</del>
</i>
to
<del class="diff-old">one.
Expand
val
by
recursively
using
this
algorithm,
passing
copies
of
</del>
the
<del class="diff-old">active
context
and
active
property
.
Add
to
each
item
of
val
a
member
</del>
<ins class="diff-chg">value
associated
with
the
</ins>
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@base
</ins>
</code>
<del class="diff-old">set
to
key
if
no
such
member
exists
yet
and
append
the
resulting
JSON
object
to
annotation
map
values
.
Set
value
to
annotation
map
values
.
</del>
<ins class="diff-chg">key.
</ins>
</li>
<li>
<del class="diff-old">Otherwise,
expand
</del>
<ins class="diff-chg">If
</ins><i>
value
<del class="diff-old">by
recursively
using
this
algorithm,
passing
copies
of
</del>
</i>
<ins class="diff-chg">is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
remove
</ins>
the
<del class="diff-old">active
context
</del>
<a href="#dfn-base-iri" title="base-iri" class="tref internalDFN">
<ins class="diff-chg">base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>
<del class="diff-old">and
property
as
active
property
.
</del>
<ins class="diff-chg">of
</ins><i><ins class="diff-chg">
result
</ins></i>.
</li>
<li>
<del class="diff-old">If
the
expanded
</del>
<ins class="diff-chg">Otherwise,
if
</ins><i>
value
<del class="diff-old">equals
null
</del>
</i>
<ins class="diff-chg">is
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>,
<del class="diff-old">continue
with
</del>
the
<del class="diff-old">next
property
-
value
pair
from
element
.
If
property's
container
mapping
</del>
<a href="#dfn-base-iri" title="base-iri" class="tref internalDFN">
<ins class="diff-chg">base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>
<ins class="diff-new">of
</ins><i><ins class="diff-new">
result
</ins></i>
is
set
to
<del class="diff-old">@list
and
</del>
<i>
value
</i>.
<ins class="diff-chg">If
it
</ins>
is
<del class="diff-old">either
</del>
not
an
<del class="diff-old">JSON
object
or
a
JSON
object
without
</del>
<a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN">
<ins class="diff-chg">absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,
an
<del class="diff-old">@list
member,
replace
value
with
a
JSON
object
</del>
<code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid-base-IRI">
<ins class="diff-chg">invalid
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>
<del class="diff-old">with
an
@list
</del>
</code>
<del class="diff-old">member
whose
value
is
set
to
value
(wrapped
in
an
array
if
it
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
</ins>
is
<del class="diff-old">not
already
one).
</del>
<ins class="diff-chg">aborted.
</ins></li></ol>
</li>
<li>
If
<del class="diff-old">expanded
property
is
</del>
<i>
<ins class="diff-chg">context
</ins></i><ins class="diff-chg">
has
</ins>
an
<del class="diff-old">array
,
</del>
<code>
<ins class="diff-chg">@vocab
</ins></code><ins class="diff-chg">
key:
</ins>
<ol class="algorithm">
<li>
<del class="diff-old">label
all
blank
nodes
in
</del>
<ins class="diff-chg">Initialize
</ins><i>
value
</i>
<ins class="diff-chg">to
the
value
associated
</ins>
with
<del class="diff-old">blank
node
identifiers
by
using
</del>
the
<del class="diff-old">Label
Blank
Nodes
Algorithm
.
</del>
<code>
<ins class="diff-chg">@vocab
</ins></code><ins class="diff-chg">
key.
</ins>
</li>
<li>
<del class="diff-old">Then,
for
each
iri
of
expanded
property
merge
a
copy
of
</del>
<ins class="diff-chg">If
</ins><i>
value
<del class="diff-old">into
the
iri
member
of
the
</del>
</i>
<ins class="diff-chg">is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
remove
any
</ins><a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN"><ins class="diff-chg">
vocabulary
mapping
</ins></a><ins class="diff-chg">
from
</ins><i>
result
<del class="diff-old">JSON
object
.
</del>
</i>.
</li>
<li>
Otherwise,
<del class="diff-old">merge
</del>
<ins class="diff-chg">if
</ins><i>
value
<del class="diff-old">into
</del>
</i>
<ins class="diff-chg">is
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,
the
<del class="diff-old">iri
member
</del>
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
<ins class="diff-chg">vocabulary
mapping
</ins></a>
of
<del class="diff-old">the
result
JSON
object
.
Set
element
to
</del>
<i>
result
<del class="diff-old">and
numProperties
</del>
</i>
<ins class="diff-chg">is
set
</ins>
to
<del class="diff-old">the
number
of
members
of
result
.
</del>
<i>
<ins class="diff-chg">value
</ins></i>.
If
<del class="diff-old">element
has
</del>
<ins class="diff-chg">it
is
not
</ins>
an
<del class="diff-old">@annotation
member,
decrease
numProperties
by
1.
If
element
has
</del>
<a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN">
<ins class="diff-chg">absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,
an
<del class="diff-old">@value
</del>
<code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid-vocab-mapping">
<ins class="diff-chg">invalid
vocab
mapping
</ins></a>
</code>
<del class="diff-old">member,
decrease
numProperties
by
1.
If
element
</del>
<ins class="diff-chg">error
</ins>
has
<del class="diff-old">an
@language
member,
decrease
numProperties
by
1
</del>
<ins class="diff-chg">been
detected
</ins>
and
<del class="diff-old">check
that
the
value
of
the
@value
member
</del>
<ins class="diff-chg">processing
</ins>
is
<del class="diff-old">a
string.
If
not,
trigger
an
INVALID_LANGUAGE_TAGGED_STRING
error.
</del>
<ins class="diff-chg">aborted.
</ins></li></ol>
</li>
<li>
<del class="diff-old">Otherwise,
if
element
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
context
</ins></i>
has
an
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@language
</ins>
</code>
<del class="diff-old">member,
decrease
numProperties
by
1
and
check
that
</del>
<ins class="diff-chg">key:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
to
</ins>
the
value
<del class="diff-old">of
</del>
<ins class="diff-chg">associated
with
</ins>
the
<code>
<del class="diff-old">@type
member
is
a
string.
If
not,
trigger
an
INVALID_TYPED_VALUE
</del>
<ins class="diff-chg">@language
</ins>
</code>
<del class="diff-old">error.
</del>
<ins class="diff-chg">key.
</ins>
</li>
<li>
If
<del class="diff-old">numProperties
</del>
<i>
<ins class="diff-chg">value
</ins></i>
is
<del class="diff-old">greater
than
0,
trigger
an
INVALID_VALUE_OBJECT
error.
</del>
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-chg">null
</ins></a>,<ins class="diff-chg">
remove
any
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins></a><ins class="diff-chg">
from
</ins><i><ins class="diff-chg">
result
</ins></i>.
</li>
<li>
<del class="diff-old">If
the
</del>
<ins class="diff-chg">Otherwise,
if
</ins><i>
value
<del class="diff-old">of
the
@value
member
equals
null
</del>
</i>
<ins class="diff-chg">is
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins>
</a>,
<ins class="diff-new">the
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-new">
default
language
</ins></a><ins class="diff-new">
of
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
is
</ins>
set
<del class="diff-old">element
</del>
to
<del class="diff-old">null
.
Return.
If
element
has
an
@type
member
whose
</del>
<ins class="diff-chg">lowercased
</ins><i>
value
</i>.
<ins class="diff-new">If
it
</ins>
is
not
<del class="diff-old">an
array
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins>
</a>,
<del class="diff-old">transform
it
to
an
array
.
If
element
has
</del>
an
<del class="diff-old">@list
or
@set
</del>
<code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid-default-language">
<ins class="diff-chg">invalid
default
language
</ins></a>
</code>
<del class="diff-old">member
</del>
<ins class="diff-chg">error
has
been
detected
</ins>
and
<del class="diff-old">numProperties
</del>
<ins class="diff-chg">processing
</ins>
is
<del class="diff-old">greater
than
1,
trigger
an
INVALID_SET_OR_LIST_OBJECT
error.
</del>
<ins class="diff-chg">aborted.
</ins></li></ol>
</li>
<li>
<del class="diff-old">Otherwise,
if
element
has
an
@set
member,
set
element
</del>
<ins class="diff-chg">Create
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><i><ins class="diff-chg">
defined
</ins></i>
to
<del class="diff-old">the
value
</del>
<ins class="diff-chg">use
to
keep
track
</ins>
of
<del class="diff-old">that
member.
</del>
<ins class="diff-chg">whether
or
not
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
has
already
been
defined
or
currently
being
defined
during
recursion.
</ins>
</li>
<li>
<del class="diff-old">Otherwise,
if
element
has
just
an
</del>
<ins class="diff-chg">For
each
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
-
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
pair
in
</ins><i><ins class="diff-chg">
context
</ins></i><ins class="diff-chg">
where
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
is
not
</ins><code><ins class="diff-chg">
@base
</ins></code>,<code><ins class="diff-chg">
@vocab
</ins></code>,<ins class="diff-chg">
or
</ins>
<code>
@language
<del class="diff-old">member,
set
element
to
null.
</del>
</code>,
<ins class="diff-chg">invoke
the
</ins><a href="#create-term-definition"><ins class="diff-chg">
Create
Term
Definition
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
for
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<i><ins class="diff-chg">
context
</ins></i><ins class="diff-chg">
for
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>,<i><ins class="diff-chg">
key
</ins></i>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
defined
</ins></i>.
</li>
</ol>
</li>
<li>
<ins class="diff-new">Return
</ins><i><ins class="diff-new">
result
</ins></i>.</li>
</ol>
</section>
</section>
<section id="create-term-definition">
<h3>
<span class="secno">
<ins class="diff-new">6.2
</ins></span><ins class="diff-new">
Create
Term
Definition
</ins></h3>
<p>
<del class="diff-old">If,
after
the
</del>
<ins class="diff-chg">This
</ins>
algorithm
<del class="diff-old">outlined
above
</del>
is
<del class="diff-old">run,
</del>
<ins class="diff-chg">called
from
</ins>
the
<del class="diff-old">resulting
element
is
an
JSON
object
</del>
<a href="#context-processing-algorithm">
<ins class="diff-chg">Context
Processing
algorithm
</ins>
</a>
<del class="diff-old">with
just
a
@graph
member,
element
is
set
</del>
to
<ins class="diff-new">create
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-new">
term
definition
</ins></a><ins class="diff-new">
in
</ins>
the
<del class="diff-old">value
of
@graph
's
value.
Finally,
if
element
is
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-chg">active
context
</ins></a><ins class="diff-chg">
for
</ins>
a
<del class="diff-old">JSON
object
,
it
is
wrapped
into
an
array
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins></a><ins class="diff-chg">
being
processed
in
a
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins>
</a>.
</p>
<section class="informative">
<h4 id="general-solution-1">
<ins class="diff-chg">General
Solution
</ins></h4>
<del class="diff-old">5.3
Context
Processing
</del>
<p>
<del class="diff-old">Processing
of
JSON-LD
data
structure
is
managed
recursively.
During
processing,
each
rule
</del>
<em>
<ins class="diff-chg">This
section
</ins>
is
<del class="diff-old">applied
using
information
provided
by
the
active
context
.
</del>
<ins class="diff-chg">non-normative.
</ins></em>
</p>
<p>
<del class="diff-old">The
active
</del>
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">Term
definitions
</ins></a><ins class="diff-chg">
are
created
by
parsing
the
information
in
the
given
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
</ins>
context
</a>
<del class="diff-old">contains
</del>
<ins class="diff-chg">for
</ins>
the
<del class="diff-old">active
</del>
<ins class="diff-chg">given
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
<del class="diff-old">definitions
which
specify
how
properties
and
values
have
to
be
interpreted
as
well
as
the
current
vocabulary
mapping
and
</del>
</a>.
<ins class="diff-chg">If
</ins>
the
<del class="diff-old">default
language
.
Each
</del>
<ins class="diff-chg">given
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
<del class="diff-old">definition
</del>
</a>
<del class="diff-old">consists
of
an
</del>
<ins class="diff-chg">is
a
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-chg">
compact
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">mapping
and
optionally
a
type
mapping
from
terms
to
datatypes
or
language
mapping
from
terms
to
language
codes,
and
a
container
mapping
.
If
</del>
</a>,
<ins class="diff-chg">it
may
omit
</ins>
an
<a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
</a>
<del class="diff-old">maps
a
</del>
<ins class="diff-chg">by
depending
on
its
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefix
</ins></a><ins class="diff-chg">
having
its
own
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
term
<del class="diff-old">to
multiple
IRIs
it
is
said
to
be
a
property
generator
.
</del>
<ins class="diff-chg">definition
</ins></a>.
If
<del class="diff-old">a
local
context
is
encountered,
information
from
</del>
the
<del class="diff-old">local
context
</del>
<a href="#dfn-prefix" title="prefix" class="tref internalDFN">
<ins class="diff-chg">prefix
</ins>
</a>
is
<del class="diff-old">merged
into
</del>
<ins class="diff-chg">a
key
in
</ins>
the
<del class="diff-old">active
context
.
A
</del>
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
</a>,
<ins class="diff-new">then
its
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-new">
term
definition
</ins>
</a>
<del class="diff-old">is
identified
within
</del>
<ins class="diff-chg">must
first
be
created,
through
recursion,
before
continuing.
Because
</ins>
a
<del class="diff-old">JSON
object
</del>
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins>
</a>
<del class="diff-old">having
</del>
<ins class="diff-chg">can
depend
on
other
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definitions
</ins></a>,
a
<del class="diff-old">@context
member
with
</del>
<ins class="diff-chg">mechanism
must
be
used
to
detect
cyclical
dependencies.
The
solution
employed
here
uses
</ins>
a
<del class="diff-old">string
,
array
</del>
<ins class="diff-chg">map,
</ins><i><ins class="diff-chg">
defined
</ins></i>,<ins class="diff-chg">
that
keeps
track
of
whether
</ins>
or
<ins class="diff-new">not
</ins>
a
<del class="diff-old">JSON
object
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins>
</a>
<del class="diff-old">value.
</del>
<ins class="diff-chg">has
been
defined
or
is
currently
in
the
process
of
being
defined.
This
map
is
checked
before
any
recursion
is
attempted.
</ins>
</p>
<p>
<del class="diff-old">This
algorithm
specifies
how
</del>
<ins class="diff-chg">After
all
dependencies
for
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
have
been
defined,
</ins>
the
<del class="diff-old">active
</del>
<ins class="diff-chg">rest
of
the
information
in
the
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
</ins>
context
</a>
<ins class="diff-new">for
the
given
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a>
is
<del class="diff-old">updated
with
a
local
context
</del>
<ins class="diff-chg">taken
into
account,
creating
the
appropriate
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a>,<a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a>,<ins class="diff-chg">
and
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
for
the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins>
</a>.
</p>
</section>
<section>
<h4 id="algorithm-1">
<ins class="diff-new">Algorithm
</ins></h4><p>
The
algorithm
<del class="diff-old">takes
three
input
variables:
</del>
<ins class="diff-chg">has
four
required
inputs
which
are:
</ins>
an
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
a
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
</a>,
<ins class="diff-new">a
</ins><i><ins class="diff-new">
term
</ins></i>,
and
<del class="diff-old">an
array
of
already
included
remote
contexts
remoteContexts
.
To
begin,
remoteContexts
is
initialized
to
an
empty
array.
</del>
<ins class="diff-chg">a
map
</ins><i><ins class="diff-chg">
defined
</ins></i>.
</p>
<del class="diff-old">All
calls
of
</del>
<ol class="algorithm">
<li>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
contains
</ins>
the
<ins class="diff-chg">key
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
and
the
associated
value
is
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
(indicating
that
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
has
already
been
created),
return.
Otherwise,
if
the
value
is
</ins><a href="#dfn-false" title="false" class="tref internalDFN"><ins class="diff-chg">
false
</ins></a>,<ins class="diff-chg">
a
</ins><code class="error">
<a href="#idl-def-JsonLdErrorCode.cyclic-IRI-mapping">
<ins class="diff-new">cyclic
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
algorithm
</del>
<ins class="diff-chg">mapping
</ins>
</a>
<del class="diff-old">pass
</del>
</code>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
Set
</ins>
the
value
<del class="diff-old">specified
in
the
algorithm
along
</del>
<ins class="diff-chg">associated
</ins>
with
<i>
<ins class="diff-new">defined
</ins></i><ins class="diff-new">
's
</ins><i><ins class="diff-new">
term
</ins></i><ins class="diff-new">
key
to
</ins><a href="#dfn-false" title="false" class="tref internalDFN"><ins class="diff-new">
false
</ins></a>.<ins class="diff-new">
This
indicates
that
</ins>
the
<del class="diff-old">active
context
,
the
currently
</del>
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins></a><ins class="diff-chg">
is
now
</ins>
being
<del class="diff-old">processed
local
context
,
and
true
for
the
vocabRelative
flag.
</del>
<ins class="diff-chg">created
but
is
not
yet
complete.
</ins></li>
<li>
<del class="diff-old">If
the
local
context
</del>
<ins class="diff-chg">Since
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keywords
</ins>
</a>
<del class="diff-old">is
</del>
<ins class="diff-chg">cannot
be
overridden,
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
must
</ins>
not
<del class="diff-old">an
array,
transform
it
to
one.
</del>
<ins class="diff-chg">be
a
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keyword
</ins></a>.<ins class="diff-chg">
Otherwise,
a
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.keyword-redefinition"><ins class="diff-chg">
keyword
redefinition
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
</ins>
</li>
<li>
<del class="diff-old">Process
each
item
</del>
<ins class="diff-chg">Remove
any
existing
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
</ins>
context
<del class="diff-old">of
</del>
</a>.
</li>
<li>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
to
</ins>
the
<ins class="diff-chg">value
associated
with
the
key
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
in
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
<del class="diff-old">as
follows:
</del>
</a>.
</li>
<li>
If
<del class="diff-old">context
equals
</del>
<i>
<ins class="diff-chg">value
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
or
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
containing
the
key-value
pair
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
-
</ins><a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>,
<del class="diff-old">reset
</del>
<ins class="diff-chg">set
</ins>
the
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>
<del class="diff-old">and
continue
with
</del>
<ins class="diff-chg">to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
</ins>
the
<del class="diff-old">next
item.
</del>
<ins class="diff-chg">value
associated
with
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
's
key
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a>,<ins class="diff-chg">
and
return.
</ins>
</li>
<li>
<del class="diff-old">If
context
</del>
<ins class="diff-chg">Otherwise,
if
</ins><i><ins class="diff-chg">
value
</ins></i>
is
a
<a href="#dfn-string" title="string" class="tref internalDFN">
string
</a>:
<ol class="algorithm">
<li>
Expand
<del class="diff-old">context
according
</del>
<i>
<ins class="diff-chg">value
</ins></i><ins class="diff-chg">
by
setting
it
</ins>
to
<ins class="diff-new">the
result
of
using
the
</ins>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
<del class="diff-old">.
</del>
<ins class="diff-chg">algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<i><ins class="diff-chg">
value
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
document
relative
</ins></i>,<a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
defined
</ins></i>.
</li>
<li>
If
<del class="diff-old">context
</del>
<i>
<ins class="diff-chg">value
</ins></i>
is
<del class="diff-old">in
the
remoteContexts
array,
raise
</del>
<code>
<ins class="diff-chg">@context
</ins></code>,
an
<code class="error">
<del class="diff-old">RECURSIVE_CONTEXT_INCLUSION
</del>
<a href="#idl-def-JsonLdErrorCode.invalid-keyword-alias">
<ins class="diff-chg">invalid
keyword
alias
</ins></a>
</code>
<del class="diff-old">error.
Otherwise,
add
context
to
remoteContexts
.
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins>
</li>
<li>
<del class="diff-old">Dereference
</del>
<ins class="diff-chg">Set
the
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
for
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
</ins>
context
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">to
</ins><i><ins class="diff-chg">
value
</ins></i>,<ins class="diff-chg">
set
the
value
associated
with
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
's
key
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a>,<ins class="diff-chg">
and
return.
</ins></li></ol>
</li>
<li>
<del class="diff-old">If
the
resulting
document
is
a
JSON
document
consisting
of
</del>
<ins class="diff-chg">Otherwise,
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
must
be
</ins>
a
<del class="diff-old">top-level
</del>
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>,
<ins class="diff-new">if
not,
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-term-definition"><ins class="diff-new">
invalid
term
definition
</ins>
</a>
<del class="diff-old">that
has
a
@context
</del>
</code>
<del class="diff-old">member
recursively
invoke
this
algorithm
passing
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
Create
</ins>
a
<del class="diff-old">copy
of
active
context
</del>
<ins class="diff-chg">new
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins>
</a>,
<del class="diff-old">the
</del>
<i>
<ins class="diff-chg">definition
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i>
value
<del class="diff-old">of
</del>
</i>
<ins class="diff-chg">contains
</ins>
the
<ins class="diff-new">key
</ins>
<code>
<del class="diff-old">@context
member
as
local
context
,
and
a
copy
of
the
remoteContexts
array.
Relative
IRIs
are
expanded
using
the
remote
context's
IRI
.
Otherwise
raise
</del>
<ins class="diff-chg">@reverse
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
contains
an
</ins><code><ins class="diff-chg">
@id
</ins></code>,<ins class="diff-chg">
an
</ins><code><ins class="diff-chg">
@type
</ins></code>,<ins class="diff-chg">
or
an
</ins><code><ins class="diff-chg">
@language
</ins></code>,<ins class="diff-chg">
member,
</ins>
an
<code class="error">
<del class="diff-old">INVALID_REMOTE_CONTEXT
</del>
<a href="#idl-def-JsonLdErrorCode.invalid-reverse-property">
<ins class="diff-chg">invalid
reverse
property
</ins></a>
</code>
<del class="diff-old">error.
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins>
</li>
<li>
<del class="diff-old">Continue
</del>
<ins class="diff-chg">If
the
value
associated
</ins>
with
the
<del class="diff-old">next
item
from
context
.
If
context
</del>
<code>
<ins class="diff-chg">@reverse
</ins></code><ins class="diff-chg">
key
</ins>
is
not
a
<del class="diff-old">JSON
object
</del>
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins>
</a>,
<del class="diff-old">raise
</del>
an
<code class="error">
<del class="diff-old">INVALID_LOCAL_CONTEXT
</del>
<a href="#idl-def-JsonLdErrorCode.invalid-IRI-mapping">
<ins class="diff-chg">invalid
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a>
</code>
<del class="diff-old">error.
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins>
</li>
<li>
Otherwise,
<del class="diff-old">if
</del>
<ins class="diff-chg">set
the
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
of
</ins><i><ins class="diff-chg">
definition
</ins></i><ins class="diff-chg">
to
the
result
of
using
the
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
</ins>
context
<del class="diff-old">is
an
JSON
object
</del>
</a>,
<del class="diff-old">perform
</del>
the
<del class="diff-old">following
steps:
If
context
has
a
</del>
<ins class="diff-chg">value
associated
with
the
</ins>
<code>
<del class="diff-old">@vocab
</del>
<ins class="diff-chg">@reverse
</ins>
</code>
<del class="diff-old">member:
if
its
</del>
<ins class="diff-chg">key
for
</ins><i>
value
</i>,
<a href="#dfn-true" title="true" class="tref internalDFN">
<ins class="diff-new">true
</ins></a><ins class="diff-new">
for
</ins><i><ins class="diff-new">
vocab
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-new">
true
</ins></a><ins class="diff-new">
for
</ins><i><ins class="diff-new">
document
relative
</ins></i>,<a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-new">
local
context
</ins></a>,<ins class="diff-new">
and
</ins><i><ins class="diff-new">
defined
</ins></i>.<ins class="diff-new">
If
the
result
</ins>
is
<del class="diff-old">neither
</del>
<ins class="diff-chg">not
</ins>
an
<a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>,
i.e.,
it
<del class="diff-old">does
not
contain
a
</del>
<ins class="diff-chg">contains
no
</ins>
colon
(
<code>:
</code>
),
<del class="diff-old">nor
null
,
trigger
</del>
an
<code class="error">
<del class="diff-old">INVALID_VOCAB_MAPPING
</del>
<a href="#idl-def-JsonLdErrorCode.invalid-IRI-mapping">
<ins class="diff-chg">invalid
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a>
</code>
<del class="diff-old">error;
otherwise
set
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
Set
</ins>
the
<del class="diff-old">active
context's
vocabulary
</del>
<a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
<ins class="diff-chg">type
</ins>
mapping
</a>
<ins class="diff-new">of
</ins><i><ins class="diff-new">
definition
</ins></i>
to
<del class="diff-old">its
value
and
remove
the
</del>
<code>
<del class="diff-old">@vocab
member
from
context
.
</del>
<ins class="diff-chg">@id
</ins></code>.
</li>
<li>
If
<del class="diff-old">context
has
a
@language
member:
if
its
</del>
<i>
value
<del class="diff-old">is
neither
a
string
nor
null
,
trigger
</del>
</i>
<ins class="diff-chg">contains
</ins>
an
<del class="diff-old">INVALID_DEFAULT_LANGUAGE
</del>
<code>
<ins class="diff-chg">@container
</ins>
</code>
<del class="diff-old">error;
otherwise
</del>
<ins class="diff-chg">member,
</ins>
set
the
<del class="diff-old">active
context's
default
language
</del>
<a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
<ins class="diff-chg">container
mapping
</ins>
</a>
<ins class="diff-new">of
</ins><i><ins class="diff-new">
definition
</ins></i>
to
<del class="diff-old">its
value
and
remove
the
</del>
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@index
</ins>
</code>
<del class="diff-old">member
from
context
.
For
each
other
key
-
value
pair
in
context
perform
the
following
steps:
Remove
</del>
<ins class="diff-chg">if
that
is
</ins>
the
<del class="diff-old">key
-
</del>
value
<del class="diff-old">pair
from
context
.
</del>
<ins class="diff-chg">of
the
</ins><code><ins class="diff-chg">
@container
</ins></code><ins class="diff-chg">
member;
otherwise
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-reverse-property"><ins class="diff-chg">
invalid
reverse
property
</ins></a></code><ins class="diff-chg">
error
has
been
detected
(reverse
properties
only
support
index-containers)
and
processing
is
aborted.
</ins>
</li>
<li>
<del class="diff-old">If
key
is
a
JSON-LD
keyword
,
continue
with
</del>
<ins class="diff-chg">Set
</ins>
the
<del class="diff-old">next
key
-
value
pair.
</del>
<a href="#dfn-reverse-property" title="reverse-property" class="tref internalDFN">
<ins class="diff-chg">reverse
property
</ins></a><ins class="diff-chg">
flag
of
</ins><i><ins class="diff-chg">
definition
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a>.
</li>
<li>
<del class="diff-old">If
value
equals
null
,
replace
</del>
<ins class="diff-chg">Set
</ins>
the
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
term
definition
</a>
<del class="diff-old">for
key
</del>
<ins class="diff-chg">of
</ins><i><ins class="diff-chg">
term
</ins></i>
in
<del class="diff-old">the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>
<ins class="diff-new">to
</ins><i><ins class="diff-new">
definition
</ins></i><ins class="diff-new">
and
the
value
associated
</ins>
with
<del class="diff-old">an
IRI
mapping
set
</del>
<i>
<ins class="diff-chg">defined
</ins></i><ins class="diff-chg">
's
key
</ins><i><ins class="diff-chg">
term
</ins></i>
to
<del class="diff-old">null
</del>
<a href="#dfn-true" title="true" class="tref internalDFN">
<ins class="diff-chg">true
</ins>
</a>
and
<del class="diff-old">continue
with
</del>
<ins class="diff-chg">return.
</ins></li></ol></li><li><ins class="diff-chg">
Set
</ins>
the
<del class="diff-old">next
key
-
value
pair.
</del>
<a href="#dfn-reverse-property" title="reverse-property" class="tref internalDFN">
<ins class="diff-chg">reverse
property
</ins></a><ins class="diff-chg">
flag
of
</ins><i><ins class="diff-chg">
definition
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-false" title="false" class="tref internalDFN"><ins class="diff-chg">
false
</ins></a>.
</li>
<li>
If
<i>
value
</i>
<ins class="diff-chg">contains
the
key
</ins><code><ins class="diff-chg">
@id
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
the
value
associated
with
the
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
key
</ins>
is
<ins class="diff-new">not
</ins>
a
<a href="#dfn-string" title="string" class="tref internalDFN">
string
</a>,
<del class="diff-old">expand
it
according
to
the
</del>
<ins class="diff-chg">an
</ins><code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid-IRI-mapping">
<ins class="diff-new">invalid
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
algorithm
</del>
<ins class="diff-chg">mapping
</ins>
</a>
</code>
<ins class="diff-new">error
has
been
detected
</ins>
and
<del class="diff-old">replace
the
term
definition
for
key
in
</del>
<ins class="diff-chg">processing
is
aborted.
</ins></li><li><ins class="diff-chg">
Otherwise,
set
</ins>
the
<del class="diff-old">active
context
with
an
</del>
<a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
</a>
<del class="diff-old">set
</del>
<ins class="diff-chg">of
</ins><i><ins class="diff-chg">
definition
</ins></i>
to
the
<del class="diff-old">expanded
</del>
<ins class="diff-chg">result
of
using
the
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
the
</ins>
value
<del class="diff-old">.
Continue
</del>
<ins class="diff-chg">associated
</ins>
with
the
<del class="diff-old">next
</del>
<code>
<ins class="diff-chg">@id
</ins></code>
key
<del class="diff-old">-
</del>
<ins class="diff-chg">for
</ins><i>
value
<del class="diff-old">pair.
</del>
</i>,
<a href="#dfn-true" title="true" class="tref internalDFN">
<ins class="diff-chg">true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
document
relative
</ins></i>,<a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
defined
</ins></i>.</li></ol>
</li>
<li>
<del class="diff-old">If
value
is
not
</del>
<ins class="diff-chg">Otherwise
if
the
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
contains
</ins>
a
<del class="diff-old">JSON
object
,
trigger
an
INVALID_TERM_DEFINITION
</del>
<ins class="diff-chg">colon
(
</ins><code>:
</code>
<del class="diff-old">error
</del>
<ins class="diff-chg">):
</ins><ol class="algorithm">
<li>
If
<i>
term
<del class="diff-old">definition
</del>
</i>
<ins class="diff-chg">is
a
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-chg">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr>
</a>
<del class="diff-old">for
</del>
<ins class="diff-chg">with
a
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefix
</ins></a><ins class="diff-chg">
that
is
a
</ins>
key
<del class="diff-old">exists
</del>
in
<del class="diff-old">the
</del>
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
<ins class="diff-chg">local
context
</ins></a><ins class="diff-chg">
a
dependency
has
been
found.
Use
this
algorithm
recursively
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<del class="diff-old">remove
it.
Initialize
a
new,
empty
term
definition
</del>
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
<ins class="diff-chg">local
context
</ins></a>,<ins class="diff-chg">
the
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefix
</ins>
</a>
<del class="diff-old">definition
.
</del>
<ins class="diff-chg">as
</ins><i><ins class="diff-chg">
term
</ins></i>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
defined
</ins></i>.
</li>
<li>
If
<del class="diff-old">value
</del>
<i>
<ins class="diff-chg">term
</ins></i><ins class="diff-chg">
's
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefix
</ins></a>
has
<del class="diff-old">an
@id
member
with
</del>
a
<del class="diff-old">value
val
:
if
val
is
null
</del>
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins>
</a>,
set
<ins class="diff-chg">the
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
of
</ins><i>
definition
</i>
to
<del class="diff-old">val
.
if
val
is
an
array
,
process
each
item
in
</del>
the
<del class="diff-old">array:
if
item
is
a
string
expand
it
according
</del>
<ins class="diff-chg">result
of
concatenating
</ins>
the
<ins class="diff-chg">value
associated
with
the
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefix
</ins></a><ins class="diff-chg">
's
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
algorithm
.
otherwise,
raise
an
INVALID_PROPERTY_GENERATOR
error.
if
val
is
an
array
,
lexicographically
sort
val
</del>
<ins class="diff-chg">mapping
</ins></a>
and
<del class="diff-old">set
definition
to
val
.
</del>
<ins class="diff-chg">the
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
's
</ins><i><ins class="diff-chg">
suffix
</ins></i>.
</li>
<li>
Otherwise,
<del class="diff-old">if
val
</del>
<i>
<ins class="diff-chg">term
</ins></i>
is
<del class="diff-old">a
string
,
expand
it
according
</del>
<ins class="diff-chg">an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.<ins class="diff-chg">
Set
</ins>
the
<a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Expansion
algorithm
</del>
<ins class="diff-chg">mapping
</ins>
</a>
<del class="diff-old">and
set
</del>
<ins class="diff-chg">of
</ins><i>
definition
</i>
to
<del class="diff-old">val
.
</del>
<i>
<ins class="diff-chg">term
</ins></i>.
</li>
</ol>
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise,
if
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
has
a
</ins><a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN"><ins class="diff-chg">
vocabulary
mapping
</ins></a>,
the
<a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
</a>
of
<i>
definition
</i>
is
set
to
<del class="diff-old">null
or
a
keyword
,
store
</del>
the
<del class="diff-old">definition
as
</del>
<ins class="diff-chg">result
of
concatenating
</ins>
the
<del class="diff-old">term
definition
for
key
in
</del>
<ins class="diff-chg">value
associated
with
</ins>
the
<del class="diff-old">active
context
</del>
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
<ins class="diff-chg">vocabulary
mapping
</ins>
</a>
and
<del class="diff-old">continue
with
the
next
key
-
value
pair
from
context
.
Otherwise,
set
the
</del>
<i>
<ins class="diff-chg">term
</ins></i>.<ins class="diff-chg">
If
it
does
not
have
a
</ins><a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN"><ins class="diff-chg">
vocabulary
mapping
</ins></a>,<ins class="diff-chg">
an
</ins><code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid-IRI-mapping">
<ins class="diff-new">invalid
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
</a>
<del class="diff-old">of
definition
to
the
result
of
expanding
key
according
the
</del>
<del class="diff-old">IRI
Expansion
algorithm
.
</del>
</code>
<ins class="diff-chg">error
been
detected
and
processing
is
aborted.
</ins>
</li>
<li>
If
<i>
value
<del class="diff-old">has
an
</del>
</i>
<ins class="diff-chg">contains
the
key
</ins>
<code>
@type
<del class="diff-old">member
with
a
</del>
</code>:
<ol class="algorithm">
<li>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
type
</ins></i><ins class="diff-chg">
to
the
</ins>
value
<del class="diff-old">val
and
val
is
not
</del>
<ins class="diff-chg">associated
with
the
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
key,
which
must
be
</ins>
a
<a href="#dfn-string" title="string" class="tref internalDFN">
string
<del class="diff-old">or
does
not
expand
to
</del>
</a>.
<ins class="diff-chg">Otherwise,
</ins>
an
<del class="diff-old">absolute
IRI
</del>
<code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid-type-mapping">
<ins class="diff-new">invalid
type
mapping
</ins>
</a>
</code>
<ins class="diff-new">error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-new">
Set
</ins><i><ins class="diff-new">
type
</ins></i><ins class="diff-new">
to
the
result
of
</ins>
using
the
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
algorithm
</a>,
<del class="diff-old">raise
an
INVALID_TYPE_MAPPING
error.
Otherwise
set
</del>
<ins class="diff-chg">passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<i><ins class="diff-chg">
type
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
value
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
document
relative
</ins></i>,<a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
defined
</ins></i>.<ins class="diff-chg">
If
</ins>
the
<ins class="diff-chg">expanded
</ins><i><ins class="diff-chg">
type
</ins></i><ins class="diff-chg">
is
neither
</ins><code><ins class="diff-chg">
@id
</ins></code>,<ins class="diff-chg">
nor
</ins><code><ins class="diff-chg">
@vocab
</ins></code>,<ins class="diff-chg">
nor
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>,
<ins class="diff-new">an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-type-mapping"><ins class="diff-new">
invalid
type
</ins>
mapping
</a>
<del class="diff-old">of
definition
to
the
expanded
val
.
Otherwise,
if
value
has
an
@language
</del>
</code>
<del class="diff-old">member
with
a
value
val
that
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
</ins>
is
<del class="diff-old">a
string
or
null
,
set
</del>
<ins class="diff-chg">aborted.
</ins></li><li><ins class="diff-chg">
Set
</ins>
the
<del class="diff-old">language
</del>
<a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
<ins class="diff-chg">type
</ins>
mapping
</a>
<del class="diff-old">of
</del>
<ins class="diff-chg">for
</ins><i>
definition
</i>
to
<del class="diff-old">the
lowercased
val
.
If
val
is
neither
a
string
nor
null
,
raise
an
INVALID_LANGUAGE_MAPPING
error.
</del>
<i>
<ins class="diff-chg">type
</ins></i>.</li></ol>
</li>
<li>
<del class="diff-old">f
</del>
<ins class="diff-chg">If
</ins><i>
value
<del class="diff-old">has
an
</del>
</i>
<ins class="diff-chg">contains
the
key
</ins>
<code>
@container
<del class="diff-old">member
with
a
</del>
</code>:
<ol class="algorithm">
<li>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
container
</ins></i><ins class="diff-chg">
to
the
</ins>
value
<del class="diff-old">val
that
equals
</del>
<ins class="diff-chg">associated
with
the
</ins><code><ins class="diff-chg">
@container
</ins></code><ins class="diff-chg">
key,
which
must
be
either
</ins>
<code>
@list
</code>,
<code>
@set
</code>,
<del class="diff-old">or
</del>
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@index
</ins>
</code>,
<del class="diff-old">set
</del>
<ins class="diff-chg">or
</ins><code><ins class="diff-chg">
@language
</ins></code>.<ins class="diff-chg">
Otherwise,
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-container-mapping"><ins class="diff-chg">
invalid
container
mapping
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
Set
</ins>
the
<a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
container
mapping
</a>
of
<i>
definition
</i>
to
<del class="diff-old">val
.
</del>
<i>
<ins class="diff-chg">container
</ins></i>.</li></ol></li><li>
If
<del class="diff-old">val
is
</del>
<i>
<ins class="diff-chg">value
</ins></i><ins class="diff-chg">
contains
the
key
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
and
does
</ins>
not
<del class="diff-old">one
of
those
values,
raise
</del>
<ins class="diff-chg">contain
the
key
</ins><code><ins class="diff-chg">
@type
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
language
</ins></i><ins class="diff-chg">
to
the
value
associated
with
the
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
key,
which
must
be
either
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
or
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a>.<ins class="diff-chg">
Otherwise,
</ins>
an
<code class="error">
<del class="diff-old">INVALID_CONTAINER_MAPPING
</del>
<a href="#idl-def-JsonLdErrorCode.invalid-language-mapping">
<ins class="diff-chg">invalid
language
mapping
</ins></a>
</code>
<del class="diff-old">error.
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins>
</li>
<li>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
language
</ins></i><ins class="diff-chg">
is
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
set
it
to
lowercased
</ins><i><ins class="diff-chg">
language
</ins></i>.<ins class="diff-chg">
Set
the
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
of
</ins><i><ins class="diff-chg">
definition
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
language
</ins></i>.
</li>
</ol>
</li>
<li>
<ins class="diff-chg">Set
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
of
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
definition
</ins></i><ins class="diff-chg">
and
set
the
value
associated
with
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
's
key
</ins><i><ins class="diff-chg">
term
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a>.
</li>
</ol>
</section>
</section>
<section id="iri-expansion">
<h3>
<span class="secno">
<del class="diff-old">5.4
</del>
<ins class="diff-chg">6.3
</ins>
</span>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
</h3>
<p>
In
JSON-LD
<del class="diff-old">documents
</del>
<ins class="diff-chg">documents,
some
</ins>
keys
and
<del class="diff-old">some
</del>
values
<del class="diff-old">are
evaluated
to
produce
an
IRI
</del>
<ins class="diff-chg">may
represent
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><ins class="diff-chg">
IRIs
</ins>
</a>.
This
section
defines
an
algorithm
for
transforming
<del class="diff-old">strings
representing
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
that
represents
</ins>
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
into
an
<a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN">
absolute
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
<ins class="diff-new">or
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-new">
blank
node
identifier
</ins>
</a>.
<ins class="diff-new">It
also
covers
transforming
</ins><a href="#dfn-keyword-alias" title="keyword-alias" class="tref internalDFN"><ins class="diff-new">
keyword
aliases
</ins></a><ins class="diff-new">
into
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-new">
keywords
</ins></a>.</p><p><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
expansion
may
occur
during
context
processing
or
during
any
of
the
other
JSON-LD
algorithms.
</ins>
If
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
expansion
occurs
during
context
processing,
<ins class="diff-new">then
</ins>
the
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
</a>
<del class="diff-old">that
is
being
processed
is
</del>
<ins class="diff-chg">and
its
related
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
map
from
the
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
algorithm
</ins></a><ins class="diff-chg">
are
</ins>
passed
to
this
algorithm.
<del class="diff-old">After
application
of
this
algorithm,
values
</del>
<ins class="diff-chg">This
allows
for
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
dependencies
to
be
</ins>
processed
<del class="diff-old">by
this
</del>
<ins class="diff-chg">via
the
</ins><a href="#create-term-definition"><ins class="diff-chg">
Create
Term
Definition
</ins>
algorithm
<del class="diff-old">are
said
</del>
</a>.
</p>
<section class="informative">
<h4 id="general-solution-2">
<ins class="diff-chg">General
Solution
</ins></h4><p><em><ins class="diff-chg">
This
section
is
non-normative.
</ins></em></p><p><ins class="diff-chg">
In
order
</ins>
to
<del class="diff-old">be
in
expanded
</del>
<ins class="diff-chg">expand
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
to
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>,
<ins class="diff-new">we
must
first
determine
if
it
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>,<ins class="diff-new">
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a>,<ins class="diff-new">
a
</ins><a href="#dfn-keyword-alias" title="keyword-alias" class="tref internalDFN"><ins class="diff-new">
keyword
alias
</ins></a>,<ins class="diff-new">
or
some
</ins>
form
<del class="diff-old">,
although
this
</del>
<ins class="diff-chg">of
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.<ins class="diff-chg">
Based
on
what
we
find,
we
handle
the
specific
kind
of
expansion;
for
example,
we
expand
a
</ins><a href="#dfn-keyword-alias" title="keyword-alias" class="tref internalDFN"><ins class="diff-chg">
keyword
alias
</ins></a><ins class="diff-chg">
to
a
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keyword
</ins></a><ins class="diff-chg">
and
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
to
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
according
to
its
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
in
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>.<ins class="diff-chg">
While
inspecting
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
we
</ins>
may
also
<del class="diff-old">include
blank
node
identifiers
</del>
<ins class="diff-chg">find
that
we
need
to
create
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
dependencies
because
we're
running
this
algorithm
during
context
processing.
We
can
tell
whether
or
not
we're
running
during
context
processing
by
checking
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
against
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>.<ins class="diff-chg">
We
know
we
need
to
create
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
in
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
when
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
a
key
in
the
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins>
</a>
and
<del class="diff-old">JSON-LD
keywords
</del>
<ins class="diff-chg">the
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
map
does
not
have
a
key
for
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
with
an
associated
value
of
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a>.<ins class="diff-chg">
The
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
map
is
used
during
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
</ins></a><ins class="diff-chg">
to
keep
track
of
which
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
have
already
been
defined
or
are
in
the
process
of
being
defined.
We
create
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
by
using
the
</ins><a href="#create-term-definition"><ins class="diff-chg">
Create
Term
Definition
algorithm
</ins>
</a>.
</p>
</section>
<section>
<h4 id="algorithm-2">
<ins class="diff-new">Algorithm
</ins></h4>
<p>
The
algorithm
takes
two
<del class="diff-old">mandatory
</del>
<ins class="diff-chg">required
</ins>
and
four
optional
input
<del class="diff-old">variables:
</del>
<ins class="diff-chg">variables.
The
required
inputs
are
an
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
and
</ins>
a
<i>
value
</i>
to
be
<del class="diff-old">expanded,
an
active
context
,
</del>
<ins class="diff-chg">expanded.
The
optional
inputs
are
</ins>
two
<del class="diff-old">flags
documentRelative
</del>
<ins class="diff-chg">flags,
</ins><i><ins class="diff-chg">
document
relative
</ins></i>
and
<del class="diff-old">vocabRelative
</del>
<i>
<ins class="diff-chg">vocab
</ins></i>,<ins class="diff-chg">
that
</ins>
specifying
whether
<i>
value
<del class="diff-old">should
</del>
</i>
<ins class="diff-chg">can
</ins>
be
interpreted
as
<ins class="diff-chg">a
</ins><a href="#dfn-relative-iri" title="relative-iri" class="tref internalDFN">
relative
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
against
the
document's
base
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
or
the
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context's
</a>
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
vocabulary
mapping
</a>,
<del class="diff-old">along
with
an
</del>
<ins class="diff-chg">respectively,
and
a
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
</a>
<del class="diff-old">passed
</del>
<ins class="diff-chg">and
a
map
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
to
be
used
</ins>
when
this
algorithm
is
used
<del class="diff-old">in
</del>
<ins class="diff-chg">during
</ins><a href="#context-processing-algorithm">
Context
Processing
<del class="diff-old">,
and
finally
an
array
path
which
is
used
to
detect
cyclic
IRI
mappings
</del>
</a>.
If
not
passed,
the
two
flags
are
set
to
<code>
false
</code>
and
<del class="diff-old">path
is
</del>
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
<ins class="diff-chg">local
context
</ins></a><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
are
</ins>
initialized
to
<del class="diff-old">an
empty
array
by
default.
The
algorithm
for
generating
an
IRI
is:
</del>
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-chg">null
</ins></a>.
</p>
<ol class="algorithm">
<li>
If
<i>
value
</i>
is
<del class="diff-old">null
or
</del>
a
<del class="diff-old">JSON-LD
</del>
<a href="#dfn-keyword" title="keyword" class="tref internalDFN">
keyword
</a>
<ins class="diff-new">or
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins>
</a>,
return
<i>
value
</i>
as
is.
</li>
<li>
If
<del class="diff-old">a
</del>
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
</a>
<del class="diff-old">has
been
passed
and
value
</del>
is
<del class="diff-old">in
the
path
array,
raise
</del>
<ins class="diff-chg">not
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
it
contains
</ins>
a
<del class="diff-old">CYCLIC_IRI_MAPPING
error.
Otherwise
append
</del>
<ins class="diff-chg">key
that
equals
</ins><i>
value
<del class="diff-old">to
path
.
If
local
context
contains
an
IRI
mapping
for
</del>
</i>,
<ins class="diff-chg">and
the
</ins>
value
<ins class="diff-chg">associated
with
the
key
</ins>
that
<ins class="diff-new">equals
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
in
</ins><i><ins class="diff-new">
defined
</ins></i>
is
not
<del class="diff-old">a
property
generator
return
</del>
<a href="#dfn-true" title="true" class="tref internalDFN">
<ins class="diff-chg">true
</ins></a>,<ins class="diff-chg">
invoke
</ins>
the
<del class="diff-old">result
of
recursively
calling
this
</del>
<a href="#create-term-definition">
<ins class="diff-chg">Create
Term
Definition
</ins>
algorithm
</a>,
passing
<del class="diff-old">the
IRI
of
the
IRI
mapping
as
new
value
,
the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
<del class="diff-old">and
</del>
</a>,
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
</a>,
<del class="diff-old">path
,
</del>
<i>
<ins class="diff-chg">value
</ins></i><ins class="diff-chg">
as
</ins><i><ins class="diff-chg">
term
</ins></i>,
and
<del class="diff-old">true
for
the
vocabRelative
flag.
If
the
result
is
</del>
<i>
<ins class="diff-chg">defined
</ins></i>.<ins class="diff-chg">
This
will
ensure
that
</ins>
a
<del class="diff-old">property
generator
,
raise
an
PROPERTY_GENERATOR_IN_TERM_DEFINITION
error.
If
an
IRI
mapping
</del>
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins>
</a>
<del class="diff-old">exists
</del>
<ins class="diff-chg">is
created
</ins>
for
<i>
value
</i>
in
<del class="diff-old">the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>
<del class="diff-old">that
</del>
<ins class="diff-chg">during
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
</ins></a>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
vocab
</ins></i>
is
<del class="diff-old">not
a
property
generator
</del>
<a href="#dfn-true" title="true" class="tref internalDFN">
<ins class="diff-chg">true
</ins>
</a>
<del class="diff-old">return
</del>
<ins class="diff-chg">and
</ins>
the
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-new">active
context
</ins></a><ins class="diff-new">
has
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-new">
term
definition
</ins></a><ins class="diff-new">
for
</ins><i>
value
<del class="diff-old">of
</del>
</i>,
<ins class="diff-chg">return
</ins>
the
<ins class="diff-chg">associated
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
mapping
</a>.
</li>
<li>
If
<i>
value
</i>
contains
a
colon
(
<code>:
</code>
),
<del class="diff-old">perform
the
following
steps:
</del>
<ins class="diff-chg">it
is
either
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
or
a
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-chg">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>:
<ol class="algorithm">
<li>
Split
<i>
value
</i>
into
a
<a href="#dfn-prefix" title="prefix" class="tref internalDFN">
prefix
</a>
and
<i>
suffix
</i>
at
the
first
occurrence
of
a
colon
(
<code>:
</code>
).
</li>
<li>
If
<a href="#dfn-prefix" title="prefix" class="tref internalDFN">
<ins class="diff-chg">prefix
</ins></a><ins class="diff-chg">
is
not
underscore
(
</ins><code><ins class="diff-chg">
_
</ins></code><ins class="diff-chg">
)
and
</ins><i>
suffix
<del class="diff-old">begins
</del>
</i>
<ins class="diff-chg">does
not
begin
</ins>
with
<ins class="diff-new">double-forward-slash
(
</ins>
<code>
//
</code>
<del class="diff-old">or
prefix
equals
_
,
return
value
as
is.
</del>
<ins class="diff-chg">),
it
may
be
a
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-chg">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>:<ol class="algorithm">
<li>
If
<del class="diff-old">a
</del>
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
</a>
<del class="diff-old">has
been
passed,
expand
prefix
by
recursively
invoking
this
algorithm
passing
</del>
<ins class="diff-chg">is
not
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
it
contains
a
key
that
equals
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN">
prefix
<del class="diff-old">as
</del>
</a>,
<ins class="diff-chg">and
the
</ins>
value
<del class="diff-old">,
</del>
<ins class="diff-chg">associated
with
</ins>
the
<ins class="diff-chg">key
that
equals
</ins><i><ins class="diff-chg">
prefix
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
defined
</ins></i><ins class="diff-chg">
is
not
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a>,<ins class="diff-chg">
invoke
the
</ins><a href="#create-term-definition"><ins class="diff-chg">
Create
Term
Definition
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
<del class="diff-old">and
</del>
</a>,
<a href="#dfn-local-context" title="local-context" class="tref internalDFN">
local
context
</a>,
<del class="diff-old">path
,
and
true
for
the
vocabRelative
flag.
If
the
expanded
</del>
<i>
prefix
<del class="diff-old">contains
a
colon
(
:
)
generate
</del>
</i>
<ins class="diff-chg">as
</ins><i><ins class="diff-chg">
term
</ins></i>,
and
<del class="diff-old">return
an
IRI
</del>
<i>
<ins class="diff-chg">defined
</ins></i>.<ins class="diff-chg">
This
will
ensure
that
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins>
</a>
<del class="diff-old">by
prepending
the
expanded
</del>
<ins class="diff-chg">is
created
for
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN">
prefix
<del class="diff-old">to
the
(possibly
empty)
suffix
using
textual
concatenation.
</del>
</a>
<ins class="diff-chg">in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
during
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
if
the
</del>
<ins class="diff-chg">If
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>
contains
<del class="diff-old">an
IRI
mapping
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins>
</a>
for
<a href="#dfn-prefix" title="prefix" class="tref internalDFN">
prefix
<del class="diff-old">that
is
not
a
property
generator
</del>
</a>,
<del class="diff-old">generate
and
</del>
return
<del class="diff-old">an
</del>
<ins class="diff-chg">the
result
of
concatenating
the
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-chg">mapping
</ins>
</a>
<del class="diff-old">by
prepending
the
</del>
<ins class="diff-chg">associated
with
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefix
</ins></a><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
suffix
</ins></i>.</li></ol></li><li><ins class="diff-chg">
Return
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
as
it
is
already
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">mapped
to
prefix
to
the
(possibly
empty)
suffix
using
textual
concatenation.
</del>
</a>.
</li>
</ol>
</li>
<li>
<del class="diff-old">Otherwise,
if
the
vocabRelative
flag
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
vocab
</ins></i>
is
<del class="diff-old">set
to
</del>
<a href="#dfn-true" title="true" class="tref internalDFN">
true
</a>,
and
<del class="diff-old">the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>
<del class="diff-old">contains
</del>
<ins class="diff-chg">has
</ins>
a
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
vocabulary
mapping
</a>,
<del class="diff-old">generate
and
</del>
return
<del class="diff-old">an
IRI
by
prepending
</del>
the
<del class="diff-old">IRI
</del>
<ins class="diff-chg">result
</ins>
of
<ins class="diff-new">concatenating
</ins>
the
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
vocabulary
mapping
</a>
<del class="diff-old">to
the
</del>
<ins class="diff-chg">with
</ins><i>
value
<del class="diff-old">using
textual
concatenation.
</del>
</i>.
</li>
<li>
Otherwise,
if
<del class="diff-old">the
documentRelative
flag
</del>
<i>
<ins class="diff-chg">document
relative
</ins></i>
is
<a href="#dfn-true" title="true" class="tref internalDFN">
<ins class="diff-new">true
</ins></a>,
set
<i>
<ins class="diff-new">value
</ins></i>
to
<del class="diff-old">true
,
resolve
</del>
<ins class="diff-chg">the
result
of
resolving
</ins><i>
value
</i>
against
the
<a href="#dfn-base-iri" title="base-iri" class="tref internalDFN">
base
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">as
per
[
RFC3986
]
and
return
the
resulting
IRI
</del>
</a>.
Only
the
basic
algorithm
in
<cite>
<a href="http://tools.ietf.org/html/rfc3986#section-5.2">
section
5.2
</a>
</cite>
of
[
<cite>
<a href="#bib-RFC3986" class="bibref">
RFC3986
</a>
</cite>
]
is
used;
neither
<cite>
<a href="http://tools.ietf.org/html/rfc3986#section-6.2.2">
Syntax-Based
Normalization
</a>
</cite>
nor
<del class="diff-old">Scheme-Based
Normalization
(as
described
in
sections
6.2.2
and
6.2.3
of
[
</del>
<cite>
<del class="diff-old">RFC3986
</del>
<a href="http://tools.ietf.org/html/rfc3986#section-6.2.3">
<ins class="diff-chg">Scheme-Based
Normalization
</ins>
</a>
</cite>
<del class="diff-old">])
</del>
are
performed.
Characters
additionally
allowed
in
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
references
are
treated
in
the
same
way
that
unreserved
characters
are
treated
in
URI
references,
per
<cite>
<a href="http://tools.ietf.org/html/rfc3987#section-6.5">
section
6.5
</a>
</cite>
of
[
<cite>
<a href="#bib-RFC3987" class="bibref">
RFC3987
</a>
</cite>
<del class="diff-old">]
</del>
<ins class="diff-chg">].
</ins>
</li>
<li>
<del class="diff-old">Otherwise
</del>
<ins class="diff-chg">If
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
is
not
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
not
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,<ins class="diff-chg">
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-IRI-mapping"><ins class="diff-chg">
invalid
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
Otherwise,
</ins>
return
<i>
value
</i>
as
is.
</li>
</ol>
</section>
</section>
</section>
<section id="expansion-algorithms">
<h2>
<span class="secno">
<ins class="diff-new">7.
</ins></span><ins class="diff-new">
Expansion
Algorithms
</ins></h2><section id="expansion-algorithm"><h3><span class="secno"><ins class="diff-new">
7.1
</ins></span><ins class="diff-new">
Expansion
Algorithm
</ins></h3>
<p>
<del class="diff-old">If
the
result
of
the
</del>
<ins class="diff-chg">This
</ins>
algorithm
<del class="diff-old">above
is
a
blank
node
identifier
,
i.e.,
</del>
<ins class="diff-chg">expands
</ins>
a
<del class="diff-old">string
</del>
<ins class="diff-chg">JSON-LD
document,
such
</ins>
that
<del class="diff-old">begins
with
_:
,
and
no
local
</del>
<ins class="diff-chg">all
</ins><a href="#dfn-context" title="context" class="tref internalDFN">
context
</a>
<del class="diff-old">has
been
passed,
generated
a
new
</del>
<ins class="diff-chg">definitions
are
removed,
all
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
and
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-chg">
compact
IRIs
</ins></a><ins class="diff-chg">
are
expanded
to
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
IRIs
</ins></a>,<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
<del class="diff-old">identifier
</del>
<ins class="diff-chg">identifiers
</ins></a>,<ins class="diff-chg">
or
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keywords
</ins>
</a>
<del class="diff-old">before
returning
the
final
result.
</del>
<ins class="diff-chg">and
all
</ins><a href="#dfn-json-ld-value" title="json-ld-value" class="tref internalDFN"><ins class="diff-chg">
JSON-LD
values
</ins></a><ins class="diff-chg">
are
expressed
in
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
arrays
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-expanded-form" title="expanded-form" class="tref internalDFN"><ins class="diff-chg">
expanded
form
</ins></a>.
</p>
<section class="informative">
<h4 id="general-solution-3">
<ins class="diff-chg">General
Solution
</ins></h4>
<del class="diff-old">5.5
Value
Expansion
</del>
<p>
<del class="diff-old">Some
values
in
</del>
<em>
<ins class="diff-chg">This
section
is
non-normative.
</ins></em></p><p><ins class="diff-chg">
Starting
with
its
root
</ins><i><ins class="diff-chg">
element
</ins></i>,<ins class="diff-chg">
we
can
process
the
</ins>
JSON-LD
<ins class="diff-new">document
recursively,
until
we
have
a
fully
</ins><a href="#dfn-expansion" title="expansion" class="tref internalDFN"><ins class="diff-new">
expanded
</ins></a><i><ins class="diff-new">
result
</ins></i>.<ins class="diff-new">
When
</ins><a href="#dfn-expansion" title="expansion" class="tref internalDFN"><ins class="diff-new">
expanding
</ins></a><ins class="diff-new">
an
</ins><i><ins class="diff-new">
element
</ins></i>,<ins class="diff-new">
we
</ins>
can
<del class="diff-old">be
expressed
</del>
<ins class="diff-chg">treat
each
one
differently
according
to
its
type,
</ins>
in
<ins class="diff-new">order
to
break
down
the
problem:
</ins></p><ol><li><ins class="diff-new">
If
the
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>,<ins class="diff-new">
there
is
nothing
to
expand.
</ins></li><li><ins class="diff-new">
Otherwise,
if
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
is
</ins>
a
<del class="diff-old">compacted
form
.
These
values
are
required
</del>
<a href="#dfn-scalar" title="scalar" class="tref internalDFN">
<ins class="diff-chg">scalar
</ins></a>,<ins class="diff-chg">
we
expand
it
according
</ins>
to
<del class="diff-old">be
expanded
at
times
when
processing
JSON-LD
documents.
A
value
</del>
<ins class="diff-chg">the
</ins><a href="#value-expansion"><ins class="diff-chg">
Value
Expansion
algorithm
</ins></a>.</li><li><ins class="diff-chg">
Otherwise,
if
the
</ins><i><ins class="diff-chg">
element
</ins></i>
is
<del class="diff-old">said
</del>
<ins class="diff-chg">an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
then
we
expand
each
of
its
items
recursively
and
return
them
in
a
new
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.</li><li><ins class="diff-chg">
Otherwise,
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>.<ins class="diff-chg">
We
expand
each
of
its
keys,
adding
them
</ins>
to
<ins class="diff-new">our
</ins><i><ins class="diff-new">
result
</ins></i>,<ins class="diff-new">
and
then
we
expand
each
value
for
each
key
recursively.
Some
of
the
keys
will
be
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
terms
</ins></a><ins class="diff-new">
or
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-new">
compact
IRIs
</ins></a><ins class="diff-new">
and
others
will
</ins>
be
<a href="#dfn-keyword" title="keyword" class="tref internalDFN">
<ins class="diff-new">keywords
</ins></a><ins class="diff-new">
or
simply
ignored
because
they
do
not
have
definitions
</ins>
in
<ins class="diff-chg">the
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins></a>.<ins class="diff-chg">
Any
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><ins class="diff-chg">
IRIs
</ins></a><ins class="diff-chg">
will
be
</ins>
expanded
<del class="diff-old">form
after
</del>
<ins class="diff-chg">using
</ins>
the
<del class="diff-old">application
of
this
algorithm.
</del>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a>.</li></ol><p><ins class="diff-chg">
Finally,
after
ensuring
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
is
in
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
we
return
</ins><i><ins class="diff-chg">
result
</ins></i>.
</p>
</section>
<section>
<h4 id="algorithm-3">
<ins class="diff-new">Algorithm
</ins></h4>
<p>
The
algorithm
<del class="diff-old">for
expanding
a
value
</del>
takes
<ins class="diff-new">three
input
variables:
</ins>
an
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-chg">active
context
</ins></a>,<ins class="diff-chg">
an
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>,
and
<ins class="diff-chg">an
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
to
be
expanded.
To
begin,
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
<del class="diff-old">.
It
</del>
</a>
is
<del class="diff-old">implemented
as
follows:
</del>
<ins class="diff-chg">set
to
the
result
of
performing,
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
</ins></a><ins class="diff-chg">
on
the
passed
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code>,<ins class="diff-chg">
or
empty
if
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
is
set
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
is
set
to
the
</ins><a href="#dfn-json-ld-input" title="json-ld-input" class="tref internalDFN"><ins class="diff-chg">
JSON-LD
input
</ins></a>.
</p>
<ol class="algorithm">
<li>
If
<del class="diff-old">value
</del>
<i>
<ins class="diff-chg">element
</ins></i>
is
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>,
return
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>.
</li>
<li>
<ins class="diff-new">If
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
is
a
</ins><a href="#dfn-scalar" title="scalar" class="tref internalDFN"><ins class="diff-new">
scalar
</ins></a>,<ol class="algorithm"><li><ins class="diff-new">
If
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
or
</ins><code><ins class="diff-new">
@graph
</ins></code>,<ins class="diff-new">
drop
the
free-floating
</ins><a href="#dfn-scalar" title="scalar" class="tref internalDFN"><ins class="diff-new">
scalar
</ins></a><ins class="diff-new">
by
returning
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>.</li><li><ins class="diff-new">
Return
the
result
of
the
</ins><a href="#value-expansion"><ins class="diff-new">
Value
Expansion
algorithm
</ins></a>,<ins class="diff-new">
passing
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>,<ins class="diff-new">
and
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
as
</ins><i><ins class="diff-new">
value
</ins></i>.</li></ol></li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
is
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>,<ol class="algorithm"><li>
Initialize
an
empty
<del class="diff-old">object
</del>
<ins class="diff-chg">array,
</ins><i>
result
<del class="diff-old">.
</del>
</i>.
</li>
<li>
<ins class="diff-chg">For
each
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
element
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
expanded
item
</ins></i><ins class="diff-chg">
to
the
result
of
using
this
algorithm
recursively,
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
as
</ins><i><ins class="diff-chg">
element
</ins></i>.
</li>
<li>
If
<ins class="diff-chg">the
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
is
<code>
<del class="diff-old">@graph
</del>
<ins class="diff-chg">@list
</ins>
</code>
or
<del class="diff-old">the
active
property's
type
</del>
<ins class="diff-chg">its
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
</ins>
mapping
</a>
is
set
to
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@list
</ins>
</code>,
<del class="diff-old">add
</del>
<ins class="diff-chg">the
</ins><i><ins class="diff-chg">
expanded
item
</ins></i><ins class="diff-chg">
must
not
be
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
or
</ins>
a
<del class="diff-old">key-value
pair
</del>
<a href="#dfn-list-object" title="list-object" class="tref internalDFN">
<ins class="diff-chg">list
object
</ins></a>,<ins class="diff-chg">
otherwise
a
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.list-of-lists"><ins class="diff-chg">
list
of
lists
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
item
</ins></i><ins class="diff-chg">
is
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
append
each
of
its
items
</ins>
to
<i>
result
<del class="diff-old">where
</del>
</i>.
<ins class="diff-chg">Otherwise,
if
</ins><i><ins class="diff-chg">
expanded
item
</ins></i><ins class="diff-chg">
is
not
null,
append
it
to
</ins><i><ins class="diff-chg">
result
</ins></i>.</li></ol></li><li><ins class="diff-chg">
Return
</ins><i><ins class="diff-chg">
result
</ins></i>.</li></ol></li><li><ins class="diff-chg">
Otherwise
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
contains
</ins>
the
key
<del class="diff-old">is
</del>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@context
</ins></code>,<ins class="diff-chg">
set
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
to
the
result
of
the
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>
and
the
value
<del class="diff-old">is
</del>
<ins class="diff-chg">of
</ins>
the
<code>
<ins class="diff-new">@context
</ins></code><ins class="diff-new">
key
as
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-new">
local
context
</ins></a>.</li><li><ins class="diff-new">
Initialize
an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a>,<i>
result
<del class="diff-old">of
expanding
</del>
</i>.
</li>
<li>
<ins class="diff-chg">For
each
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
and
</ins><i>
value
<del class="diff-old">according
</del>
</i>
<ins class="diff-chg">in
</ins><i><ins class="diff-chg">
element
</ins></i>,<ins class="diff-chg">
ordered
lexicographically
by
</ins><i><ins class="diff-chg">
key
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@context
</ins></code>,<ins class="diff-chg">
continue
</ins>
to
the
<ins class="diff-new">next
</ins><i><ins class="diff-new">
key
</ins></i>.</li><li><ins class="diff-new">
Set
</ins><i><ins class="diff-new">
expanded
property
</ins></i><ins class="diff-new">
to
the
result
of
using
the
</ins>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Expansion
algorithm
</a>,
passing
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-chg">active
context
</ins></a>,<i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
value
</ins></i>,<ins class="diff-chg">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN">
true
</a>
for
<del class="diff-old">the
documentRelative
flag.
Then
return
result
.
</del>
<i>
<ins class="diff-chg">vocab
</ins></i>.
</li>
<li>
<del class="diff-old">Add
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
or
it
neither
contains
</ins>
a
<del class="diff-old">key-value
pair
</del>
<ins class="diff-chg">colon
(
</ins><code>:</code><ins class="diff-chg">
)
nor
it
is
a
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keyword
</ins></a>,<ins class="diff-chg">
drop
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
by
continuing
</ins>
to
<del class="diff-old">result
where
</del>
the
<ins class="diff-new">next
</ins><i>
key
</i>.
</li>
<li>
<ins class="diff-new">If
</ins><i><ins class="diff-new">
expanded
property
</ins></i>
is
<ins class="diff-new">a
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-new">
keyword
</ins></a>:<ol class="algorithm"><li><ins class="diff-new">
If
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
equals
</ins>
<code>
<del class="diff-old">@value
</del>
<ins class="diff-chg">@reverse
</ins></code>,<ins class="diff-chg">
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-reverse-property-map"><ins class="diff-chg">
invalid
reverse
property
map
</ins></a>
</code>
<ins class="diff-new">error
has
been
detected
</ins>
and
<del class="diff-old">the
value
</del>
<ins class="diff-chg">processing
</ins>
is
<del class="diff-old">value
.
</del>
<ins class="diff-chg">aborted.
</ins>
</li>
<li>
If
<del class="diff-old">the
active
</del>
<i>
<ins class="diff-chg">result
</ins></i><ins class="diff-chg">
has
already
an
</ins><i><ins class="diff-chg">
expanded
</ins>
property
</i>
<ins class="diff-new">member,
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.colliding-keywords"><ins class="diff-new">
colliding
keywords
</ins>
</a>
</code>
<ins class="diff-new">error
</ins>
has
<ins class="diff-new">been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
expanded
property
</ins></i><ins class="diff-new">
is
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
and
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
not
</ins>
a
<del class="diff-old">type
mapping
</del>
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins>
</a>,
<del class="diff-old">add
a
key-value
pair
</del>
<ins class="diff-chg">an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid--id-value"><ins class="diff-chg">
invalid
@id
value
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
Otherwise,
set
</ins><i><ins class="diff-chg">
expanded
value
</ins></i>
to
<ins class="diff-chg">the
</ins>
result
<del class="diff-old">where
</del>
<ins class="diff-chg">of
using
</ins>
the
<del class="diff-old">key
</del>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<i><ins class="diff-chg">
value
</ins></i>,<ins class="diff-chg">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
document
relative
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
property
</ins></i>
is
<code>
@type
</code>
and
<del class="diff-old">the
</del>
<i>
value
</i>
is
<ins class="diff-new">neither
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-new">
string
</ins></a><ins class="diff-new">
nor
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a><ins class="diff-new">
of
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-new">
strings
</ins></a>,<ins class="diff-new">
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-type-value"><ins class="diff-new">
invalid
type
value
</ins></a></code><ins class="diff-new">
error
has
been
detected
and
processing
is
aborted.
Otherwise,
set
</ins><i><ins class="diff-new">
expanded
value
</ins></i><ins class="diff-new">
to
</ins>
the
<ins class="diff-chg">result
of
using
the
</ins><a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-chg">Expansion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins>
</a>
<del class="diff-old">associated
with
the
type
mapping
</del>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,<ins class="diff-chg">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins>
</a>
<ins class="diff-new">for
</ins><i><ins class="diff-new">
document
relative
</ins></i><ins class="diff-new">
to
expand
the
</ins><i><ins class="diff-new">
value
</ins></i>
or
<ins class="diff-new">each
of
its
items.
</ins></li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
expanded
property
</ins></i><ins class="diff-new">
is
</ins><code><ins class="diff-new">
@graph
</ins></code>,<ins class="diff-new">
set
</ins><i><ins class="diff-new">
expanded
value
</ins></i><ins class="diff-new">
to
the
result
of
using
this
algorithm
recursively
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<code><ins class="diff-new">
@graph
</ins></code><ins class="diff-new">
for
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>,<ins class="diff-new">
and
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
element
</ins></i>.</li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
expanded
property
</ins></i><ins class="diff-new">
is
</ins><code><ins class="diff-new">
@value
</ins></code><ins class="diff-new">
and
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
not
</ins>
a
<del class="diff-old">newly
generated
blank
node
identifier
</del>
<a href="#dfn-scalar" title="scalar" class="tref internalDFN">
<ins class="diff-chg">scalar
</ins>
</a>
<del class="diff-old">if
the
type
mapping
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-value-object-value"><ins class="diff-chg">
invalid
value
object
value
</ins>
</a>
</code>
<ins class="diff-new">error
has
been
detected
and
processing
</ins>
is
<ins class="diff-new">aborted.
Otherwise,
</ins>
set
<i>
<ins class="diff-new">expanded
value
</ins></i>
to
<del class="diff-old">a
blank
node
identifier
.
</del>
<i>
<ins class="diff-chg">value
</ins></i>.<ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
the
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
and
continue
with
the
next
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
from
</ins><i><ins class="diff-chg">
element
</ins></i>.<ins class="diff-chg">
Null
values
need
to
be
preserved
in
this
case
as
the
meaning
of
an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
depends
on
the
existence
of
an
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member.
</ins>
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
and
</ins><i>
value
</i>
is
<ins class="diff-new">not
</ins>
a
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins></a>,<ins class="diff-chg">
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-language-tagged-string"><ins class="diff-chg">
invalid
language-tagged
</ins>
string
</a>
</code>
<ins class="diff-new">error
has
been
detected
</ins>
and
<del class="diff-old">the
active
</del>
<ins class="diff-chg">processing
is
aborted.
Otherwise,
set
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
to
lowercased
</ins><i><ins class="diff-chg">
value
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
</ins>
property
<del class="diff-old">has
</del>
</i>
<ins class="diff-chg">is
</ins><code><ins class="diff-chg">
@index
</ins></code><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
not
</ins>
a
<del class="diff-old">language
mapping
or
</del>
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins></a>,
an
<del class="diff-old">default
language
</del>
<code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid--index-value">
<ins class="diff-chg">invalid
@index
value
</ins>
</a>
</code>
<ins class="diff-new">error
has
been
detected
and
processing
</ins>
is
<ins class="diff-new">aborted.
Otherwise,
</ins>
set
<del class="diff-old">in
</del>
<i>
<ins class="diff-chg">expanded
value
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
value
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@list
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@graph
</ins></code>,<ins class="diff-chg">
continue
with
</ins>
the
<ins class="diff-chg">next
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
from
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
to
remove
the
free-floating
list..
</ins></li><li><ins class="diff-chg">
Otherwise,
initialize
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
to
the
result
of
using
this
algorithm
recursively
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<del class="diff-old">add
</del>
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
<ins class="diff-chg">active
property
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
element
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">key-value
pair
</del>
<a href="#dfn-list-object" title="list-object" class="tref internalDFN">
<ins class="diff-chg">list
object
</ins></a>,<ins class="diff-chg">
a
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.list-of-lists"><ins class="diff-chg">
list
of
lists
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
</ins></li></ol></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
set
</ins><i><ins class="diff-chg">
expanded
value
</ins></i>
to
<del class="diff-old">result
where
</del>
the
<del class="diff-old">key
</del>
<ins class="diff-chg">result
of
using
this
algorithm
recursively,
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
element
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
property
</ins></i>
is
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@reverse
</ins>
</code>
and
<del class="diff-old">the
</del>
<i>
value
</i>
is
<del class="diff-old">the
language
tag
associated
with
the
language
mapping
</del>
<ins class="diff-chg">not
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>,<ins class="diff-chg">
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid--reverse-value"><ins class="diff-chg">
invalid
@reverse
value
</ins>
</a>
<del class="diff-old">or
</del>
</code>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
Otherwise
</ins><ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
to
</ins>
the
<ins class="diff-chg">result
of
using
this
algorithm
recursively,
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<code><ins class="diff-chg">
@reverse
</ins></code><ins class="diff-chg">
as
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
<del class="diff-old">or
</del>
</a>,
<ins class="diff-chg">and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
as
</ins><i><ins class="diff-chg">
element
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
contains
an
</ins><code><ins class="diff-chg">
@reverse
</ins></code><ins class="diff-chg">
member,
i.e.,
properties
that
are
reversed
twice,
execute
for
each
of
its
</ins><i><ins class="diff-chg">
property
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
item
</ins></i>
the
<del class="diff-old">default
language
</del>
<ins class="diff-chg">following
steps:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
does
not
have
a
</ins><i><ins class="diff-chg">
property
</ins></i><ins class="diff-chg">
member,
create
one
and
set
its
value
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>.
</li>
<li>
<del class="diff-old">Return
</del>
<ins class="diff-chg">Append
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
to
the
value
of
the
</ins><i><ins class="diff-chg">
property
</ins></i><ins class="diff-chg">
member
of
</ins><i>
result
<del class="diff-old">.
</del>
</i>.
</li>
</ol>
<del class="diff-old">5.6
Label
Blank
Nodes
Algorithm
The
algorithm
takes
a
single
input
variable:
</del>
</li>
<li>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
contains
members
other
than
</ins><code><ins class="diff-chg">
@reverse
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
does
not
have
</ins>
an
<del class="diff-old">element
</del>
<code>
<ins class="diff-chg">@reverse
</ins></code><ins class="diff-chg">
member,
create
one
and
set
its
value
</ins>
to
<del class="diff-old">be
labeled
with
blank
node
identifiers
</del>
<ins class="diff-chg">an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins>
</a>.
</li>
<li>
<ins class="diff-chg">Reference
the
value
of
the
</ins><code><ins class="diff-chg">
@reverse
</ins></code><ins class="diff-chg">
member
in
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
reverse
map
</ins></i>.</li><li><ins class="diff-chg">
For
each
</ins><i><ins class="diff-chg">
property
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
items
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
other
than
</ins><code><ins class="diff-chg">
@reverse
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
For
each
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
items
</ins></i>:
<ol class="algorithm">
<li>
If
<del class="diff-old">element
</del>
<i>
<ins class="diff-chg">item
</ins></i>
is
<ins class="diff-new">a
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN"><ins class="diff-new">
value
object
</ins></a><ins class="diff-new">
or
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-new">
list
object
</ins></a>,
an
<code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid--reverse-value">
<ins class="diff-chg">invalid
reverse
property
value
</ins></a></code><ins class="diff-chg">
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
reverse
map
</ins></i><ins class="diff-chg">
has
no
</ins><i><ins class="diff-chg">
property
</ins></i><ins class="diff-chg">
member,
create
one
and
initialize
its
value
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>.
</li>
<li>
<ins class="diff-new">Append
</ins><i><ins class="diff-new">
item
</ins></i><ins class="diff-new">
to
the
value
of
the
</ins><i><ins class="diff-new">
property
</ins></i><ins class="diff-new">
member
in
</ins><i><ins class="diff-new">
reverse
map
</ins></i>.</li></ol></li></ol></li></ol></li><li><ins class="diff-new">
Continue
with
the
next
</ins><i><ins class="diff-new">
key
</ins></i><ins class="diff-new">
from
</ins><i><ins class="diff-new">
element
</ins></i>.</li></ol></li><li><ins class="diff-new">
Unless
</ins><i><ins class="diff-new">
expanded
value
</ins></i><ins class="diff-new">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins>
</a>,
<del class="diff-old">recursively
apply
this
algorithm
</del>
<ins class="diff-chg">set
the
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
result
</ins></i>
to
<del class="diff-old">all
its
items.
</del>
<i>
<ins class="diff-chg">expanded
value
</ins></i>.</li><li><ins class="diff-chg">
Continue
with
the
next
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
from
</ins><i><ins class="diff-chg">
element.
</ins></i>.</li></ol>
</li>
<li>
Otherwise,
if
<del class="diff-old">element
</del>
<i>
<ins class="diff-chg">key
</ins></i><ins class="diff-chg">
's
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i>
is
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<del class="diff-old">with
</del>
<ins class="diff-chg">then
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
expanded
from
</ins>
a
<del class="diff-old">@list
</del>
<a href="../json-ld/#dfn-language-map" title="language-map" class="tref externalDFN">
<ins class="diff-chg">language
map
</ins></a><ins class="diff-chg">
as
follows:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.</li><li><ins class="diff-chg">
For
each
key-value
pair
</ins><i><ins class="diff-chg">
language
</ins></i><ins class="diff-chg">
-
</ins><i><ins class="diff-chg">
language
value
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
value
</ins></i>,<ins class="diff-chg">
ordered
lexicographically
by
</ins><i><ins class="diff-chg">
language
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
language
value
</ins></i><ins class="diff-chg">
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
set
it
to
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
containing
only
</ins><i><ins class="diff-chg">
language
value
</ins></i>.</li><li><ins class="diff-chg">
For
each
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
language
value
</ins></i>:<ol class="algorithm"><li><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
must
be
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
otherwise
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-language-map-value"><ins class="diff-chg">
invalid
language
map
value
</ins></a>
</code>
<del class="diff-old">member,
recursively
apply
this
algorithm
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
Append
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>
to
<del class="diff-old">all
items
</del>
<i>
<ins class="diff-chg">expanded
value
</ins></i><ins class="diff-chg">
that
consists
</ins>
of
<del class="diff-old">the
</del>
<ins class="diff-chg">two
key-value
pairs:
(
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@value
</ins>
</code>
<del class="diff-old">member's
value.
</del>
<ins class="diff-chg">-
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
)
and
(
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
-lowercased
</ins><i><ins class="diff-chg">
language
</ins></i><ins class="diff-chg">
).
</ins></li></ol></li></ol></li></ol>
</li>
<li>
Otherwise,
if
<del class="diff-old">element
</del>
<i>
<ins class="diff-chg">key
</ins></i><ins class="diff-chg">
's
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@index
</ins></code><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i>
is
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<ins class="diff-new">then
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
expanded
from
an
index
map
as
follows:
</ins>
<ol class="algorithm">
<li>
<ins class="diff-new">Initialize
</ins><i><ins class="diff-new">
expanded
value
</ins></i><ins class="diff-new">
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>.</li><li>
For
each
<del class="diff-old">key
</del>
<ins class="diff-chg">key-value
pair
</ins><i><ins class="diff-chg">
index
</ins></i>
-
<i>
<ins class="diff-chg">index
</ins>
value
<del class="diff-old">pair
</del>
</i>
<ins class="diff-chg">in
</ins><i><ins class="diff-chg">
value
</ins></i>,
ordered
<ins class="diff-new">lexicographically
</ins>
by
<del class="diff-old">key
recursively
apply
</del>
<i>
<ins class="diff-chg">index
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
index
value
</ins></i><ins class="diff-chg">
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
set
it
to
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
containing
only
</ins><i><ins class="diff-chg">
index
value
</ins></i>.</li><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
index
value
</ins></i><ins class="diff-chg">
to
the
result
of
using
</ins>
this
algorithm
<ins class="diff-new">recursively,
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<i><ins class="diff-new">
key
</ins></i><ins class="diff-new">
as
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>,<ins class="diff-new">
and
</ins><i><ins class="diff-new">
index
value
</ins></i><ins class="diff-new">
as
</ins><i><ins class="diff-new">
element
</ins></i>.</li><li><ins class="diff-new">
For
each
</ins><i><ins class="diff-new">
item
</ins></i><ins class="diff-new">
in
</ins><i><ins class="diff-new">
index
value
</ins></i>:<ol class="algorithm"><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
item
</ins></i><ins class="diff-new">
does
not
have
the
key
</ins><code><ins class="diff-new">
@index
</ins></code>,<ins class="diff-new">
add
the
key-value
pair
(
</ins><code><ins class="diff-new">
@index
</ins></code><ins class="diff-new">
-
</ins><i><ins class="diff-new">
index
</ins></i><ins class="diff-new">
)
</ins>
to
<i>
<ins class="diff-chg">item
</ins></i>.</li><li><ins class="diff-chg">
Append
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
expanded
</ins>
value
<del class="diff-old">.
</del>
</i>.
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>
<ins class="diff-chg">Otherwise,
initialize
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
to
the
result
of
using
this
algorithm
recursively,
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
for
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
element
</ins></i>.
</li>
<li>
If
<i>
<ins class="diff-chg">expanded
value
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
ignore
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
by
continuing
to
the
next
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
from
</ins><i>
element
</i>.
</li>
<li>
<ins class="diff-chg">If
the
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
associated
to
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>
is
<code>
<ins class="diff-new">@list
</ins></code><ins class="diff-new">
and
</ins><i><ins class="diff-new">
expanded
value
</ins></i><ins class="diff-new">
is
not
already
</ins>
a
<del class="diff-old">node
</del>
<a href="#dfn-list-object" title="list-object" class="tref internalDFN">
<ins class="diff-chg">list
object
</ins></a>,<ins class="diff-chg">
convert
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
to
a
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-chg">
list
</ins>
object
</a>
<del class="diff-old">without
</del>
<ins class="diff-chg">by
first
setting
it
to
</ins>
an
<a href="#dfn-array" title="array" class="tref internalDFN">
<ins class="diff-new">array
</ins></a><ins class="diff-new">
containing
only
</ins><i><ins class="diff-new">
expanded
value
</ins></i><ins class="diff-new">
if
it
is
not
already
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>,<ins class="diff-new">
and
then
by
setting
it
to
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
containing
the
key-value
pair
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@list
</ins></code><ins class="diff-chg">
-
</ins><i><ins class="diff-chg">
expanded
value
</ins></i>.</li><li><ins class="diff-chg">
Otherwise,
if
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
associated
to
</ins><i><ins class="diff-chg">
key
</ins></i><ins class="diff-chg">
indicates
that
it
is
a
</ins><a href="#dfn-reverse-property" title="reverse-property" class="tref internalDFN"><ins class="diff-chg">
reverse
property
</ins></a><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@reverse
</ins>
</code>
member,
create
<del class="diff-old">a
new
</del>
<ins class="diff-chg">one
and
initialize
its
value
to
an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>.</li><li><ins class="diff-chg">
Reference
the
value
of
the
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@reverse
</ins>
</code>
member
<del class="diff-old">and
assign
</del>
<ins class="diff-chg">in
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
reverse
map
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
set
</ins>
it
<ins class="diff-new">to
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a><ins class="diff-new">
containing
</ins><i><ins class="diff-new">
expanded
value
</ins></i>.</li><li><ins class="diff-new">
For
each
</ins><i><ins class="diff-new">
item
</ins></i><ins class="diff-new">
in
</ins><i><ins class="diff-new">
expanded
value
</ins></i><ol class="algorithm"><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
item
</ins></i><ins class="diff-new">
is
</ins>
a
<del class="diff-old">new
blank
node
identifier
</del>
<a href="#dfn-value-object" title="value-object" class="tref internalDFN">
<ins class="diff-chg">value
object
</ins>
</a>
<del class="diff-old">according
the
Generate
Blank
Node
Identifier
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-chg">
list
object
</ins></a>,<ins class="diff-chg">
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid--reverse-value"><ins class="diff-chg">
invalid
reverse
property
value
</ins>
</a>
<del class="diff-old">algorithm.
</del>
</code>
<ins class="diff-chg">has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
reverse
map
</ins></i><ins class="diff-chg">
has
no
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
member,
create
one
and
initialize
its
value
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.</li><li><ins class="diff-chg">
Append
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
to
the
value
of
the
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
reverse
map
</ins></i>.
</li>
</ol>
</li>
</ol>
<del class="diff-old">5.7
Generate
Blank
Node
Identifier
This
algorithm
</del>
</li>
<li>
<ins class="diff-chg">Otherwise,
if
</ins><i><ins class="diff-chg">
key
</ins></i>
is
<del class="diff-old">used
to
generate
new
blank
node
identifiers
or
to
relabel
existing
blank
node
identifiers
with
</del>
<ins class="diff-chg">not
</ins>
a
<del class="diff-old">new
</del>
<a href="#dfn-reverse-property" title="reverse-property" class="tref internalDFN">
<ins class="diff-chg">reverse
property
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
does
not
have
an
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
member,
create
</ins>
one
<ins class="diff-new">and
initialize
its
value
</ins>
to
<del class="diff-old">avoid
collision
by
</del>
<ins class="diff-chg">an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.</li><li><ins class="diff-chg">
Append
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
to
value
of
</ins>
the
<del class="diff-old">introduction
</del>
<i>
<ins class="diff-chg">expanded
property
</ins></i><ins class="diff-chg">
member
</ins>
of
<del class="diff-old">new
ones.
</del>
<i>
<ins class="diff-chg">result
</ins></i>.</li></ol></li></ol></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
contains
the
key
</ins><code><ins class="diff-chg">
@value
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
The
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
must
not
contain
any
keys
other
than
</ins><code><ins class="diff-chg">
@value
</ins></code>,<code><ins class="diff-chg">
@language
</ins></code>,<code><ins class="diff-chg">
@type
</ins></code>,<ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
@index
</ins></code>.
It
<del class="diff-old">needs
</del>
<ins class="diff-chg">must
not
contain
both
the
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
key
and
the
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
key.
Otherwise,
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-value-object"><ins class="diff-chg">
invalid
value
object
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
If
the
value
of
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
's
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
key
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
then
set
</ins><i><ins class="diff-chg">
result
</ins></i>
to
<del class="diff-old">keep
</del>
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-chg">null
</ins></a>.</li><li><ins class="diff-chg">
Otherwise,
if
the
value
of
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
's
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member
is
not
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
contains
the
key
</ins><code><ins class="diff-chg">
@language
</ins></code>,
an
<del class="diff-old">identifier
map
,
</del>
<code class="error">
<a href="#idl-def-JsonLdErrorCode.invalid-language-tagged-value">
<ins class="diff-chg">invalid
language-tagged
value
</ins></a></code><ins class="diff-chg">
error
has
been
detected
(only
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
strings
</ins></a><ins class="diff-chg">
can
be
language-tagged)
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
Otherwise,
if
the
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
has
</ins>
a
<del class="diff-old">counter
,
</del>
<code>
<ins class="diff-chg">@type
</ins></code><ins class="diff-chg">
member
</ins>
and
<ins class="diff-new">its
value
is
not
</ins>
a
<del class="diff-old">prefix
between
</del>
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins></a>,<ins class="diff-chg">
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-typed-value"><ins class="diff-chg">
invalid
typed
value
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
</ins></li></ol></li><li><ins class="diff-chg">
Otherwise,
if
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
contains
the
key
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
and
</ins>
its
<del class="diff-old">executions
</del>
<ins class="diff-chg">associated
value
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
set
it
</ins>
to
<ins class="diff-new">an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a><ins class="diff-new">
containing
only
the
associated
value.
</ins></li><li><ins class="diff-new">
Otherwise,
if
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
contains
the
key
</ins><code><ins class="diff-new">
@set
</ins></code><ins class="diff-new">
or
</ins><code><ins class="diff-new">
@list
</ins></code>:<ol class="algorithm"><li><ins class="diff-new">
The
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
must
contain
at
most
one
other
key
and
that
key
must
</ins>
be
<del class="diff-old">able
</del>
<code>
<ins class="diff-chg">@index
</ins></code>.<ins class="diff-chg">
Otherwise,
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.invalid-set-or-list-object"><ins class="diff-chg">
invalid
set
or
list
object
</ins></a></code><ins class="diff-chg">
error
has
been
detected
and
processing
is
aborted.
</ins></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
contains
the
key
</ins><code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
then
set
</ins><i><ins class="diff-chg">
result
</ins></i>
to
<del class="diff-old">generate
new
blank
node
identifiers
</del>
<ins class="diff-chg">the
key's
associated
value.
</ins></li></ol></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
contains
only
the
key
</ins><code><ins class="diff-chg">
@language
</ins></code>,<ins class="diff-chg">
set
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins>
</a>.
<del class="diff-old">The
counter
</del>
</li>
<li>
<ins class="diff-chg">If
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>
is
<del class="diff-old">initialized
</del>
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-chg">null
</ins></a><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@graph
</ins></code>,<ins class="diff-chg">
drop
free-floating
values
as
follows:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
is
an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
or
contains
the
keys
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@list
</ins></code>,<ins class="diff-chg">
set
</ins><i><ins class="diff-chg">
result
</ins></i>
to
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-new">null
</ins></a>.</li><li><ins class="diff-new">
Otherwise,
if
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
whose
only
key
is
</ins>
<code>
<del class="diff-old">0
</del>
<ins class="diff-chg">@id
</ins></code>,<ins class="diff-chg">
set
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>.</li></ol></li><li><ins class="diff-chg">
Return
</ins><i><ins class="diff-chg">
result
</ins></i>.</li></ol><p><ins class="diff-chg">
If,
after
the
above
algorithm
is
run,
the
result
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
that
contains
only
an
</ins><code><ins class="diff-chg">
@graph
</ins>
</code>
<del class="diff-old">and
</del>
<ins class="diff-chg">key,
set
the
result
to
the
value
of
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
's
value.
Otherwise,
if
the
result
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
it
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.<ins class="diff-chg">
Finally,
if
the
result
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
then
set
the
result
to
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
containing
only
the
result.
</ins></p></section></section><section id="value-expansion"><h3><span class="secno"><ins class="diff-chg">
7.2
</ins></span><ins class="diff-chg">
Value
Expansion
</ins></h3><p><ins class="diff-chg">
Some
values
in
JSON-LD
can
be
expressed
in
a
</ins><a href="#dfn-compacted-form" title="compacted-form" class="tref internalDFN"><ins class="diff-chg">
compact
form
</ins></a>.<ins class="diff-chg">
These
values
are
required
to
be
</ins><a href="#dfn-expansion" title="expansion" class="tref internalDFN"><ins class="diff-chg">
expanded
</ins></a><ins class="diff-chg">
at
times
when
processing
JSON-LD
documents.
A
value
is
said
to
be
in
</ins><dfn id="dfn-expanded-form" title="expanded-form"><ins class="diff-chg">
expanded
form
</ins></dfn><ins class="diff-chg">
after
the
application
of
this
algorithm.
</ins></p><section class="informative"><h4 id="general-solution-4"><ins class="diff-chg">
General
Solution
</ins></h4><p>
<em>
<del class="diff-old">prefix
</del>
<ins class="diff-chg">This
section
</ins>
is
<ins class="diff-new">non-normative.
</ins></em></p><p><ins class="diff-new">
If
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
has
a
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-new">
type
mapping
</ins></a><ins class="diff-new">
in
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>
set
to
<code>
<del class="diff-old">_:t
</del>
<ins class="diff-chg">@id
</ins>
</code>
<del class="diff-old">by
default.
</del>
<ins class="diff-chg">or
</ins><code><ins class="diff-chg">
@vocab
</ins></code>,<ins class="diff-chg">
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
with
a
single
member
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
whose
values
is
the
result
of
using
the
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a><ins class="diff-chg">
on
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
returned.
</ins>
</p>
<p>
<ins class="diff-new">Otherwise,
the
result
will
be
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
containing
an
</ins><code><ins class="diff-new">
@value
</ins></code><ins class="diff-new">
member
whose
value
is
the
passed
</ins><i><ins class="diff-new">
value
</ins></i>.<ins class="diff-new">
Additionally,
an
</ins><code><ins class="diff-new">
@type
</ins></code><ins class="diff-new">
member
will
be
included
if
there
is
a
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-new">
type
mapping
</ins></a><ins class="diff-new">
associated
with
the
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
or
an
</ins><code><ins class="diff-new">
@language
</ins></code><ins class="diff-new">
member
if
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-new">
string
</ins></a><ins class="diff-new">
and
there
is
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-new">
language
mapping
</ins></a><ins class="diff-new">
associated
with
the
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>.</p></section><section><h4 id="algorithm-4"><ins class="diff-new">
Algorithm
</ins></h4><p>
The
algorithm
takes
<ins class="diff-new">three
required
inputs:
an
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<ins class="diff-new">
an
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>,<ins class="diff-new">
and
</ins>
a
<del class="diff-old">single
input
variable
identifier
which
might
be
null
.
</del>
<i>
<ins class="diff-chg">value
</ins></i><ins class="diff-chg">
to
expand.
</ins>
</p>
<ol class="algorithm">
<li>
If
the
<del class="diff-old">identifier
</del>
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
<ins class="diff-chg">active
property
</ins></a><ins class="diff-chg">
has
a
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
that
</ins>
is
<del class="diff-old">not
null
</del>
<code>
<ins class="diff-chg">@id
</ins></code>,<ins class="diff-chg">
return
a
new
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins>
</a>
<ins class="diff-new">containing
a
single
key-value
pair
where
the
key
is
</ins><code><ins class="diff-new">
@id
</ins></code>
and
<ins class="diff-new">the
value
</ins>
is
<del class="diff-old">in
</del>
the
<del class="diff-old">identifier
map
,
return
</del>
<ins class="diff-chg">result
of
using
</ins>
the
<del class="diff-old">mapped
identifier.
</del>
<a href="#iri-expansion">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<i><ins class="diff-chg">
value
</ins></i>,<ins class="diff-chg">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
document
relative
</ins></i>.
</li>
<li>
<del class="diff-old">Otherwise,
generate
</del>
<ins class="diff-chg">If
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
has
a
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
that
is
</ins><code><ins class="diff-chg">
@vocab
</ins></code>,<ins class="diff-chg">
return
</ins>
a
new
<del class="diff-old">blankNodeIdentifier
by
concatenating
prefix
</del>
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
<ins class="diff-chg">JSON
object
</ins></a><ins class="diff-chg">
containing
a
single
key-value
pair
where
the
key
is
</ins><code><ins class="diff-chg">
@id
</ins></code>
and
<del class="diff-old">counter
.
</del>
<ins class="diff-chg">the
value
is
the
result
of
using
the
</ins><a href="#iri-expansion"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Expansion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<i><ins class="diff-chg">
value
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,<ins class="diff-chg">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
document
relative
</ins></i>.
</li>
<li>
<del class="diff-old">Increment
counter
by
</del>
<ins class="diff-chg">Otherwise,
initialize
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
to
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
with
an
</ins>
<code>
<del class="diff-old">1
.
</del>
<ins class="diff-chg">@value
</ins></code><ins class="diff-chg">
member
whose
value
is
set
to
</ins><i><ins class="diff-chg">
value
</ins></i>.
</li>
<li>
If
<del class="diff-old">identifier
is
not
null
</del>
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
<ins class="diff-chg">active
property
</ins></a><ins class="diff-chg">
has
a
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins>
</a>,
<del class="diff-old">create
</del>
<ins class="diff-chg">add
an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
to
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
and
set
its
value
to
the
value
associated
with
the
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">new
entry
</del>
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
If
a
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
is
associated
with
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>
in
<del class="diff-old">identifier
map
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-chg">active
context
</ins></a>,<ins class="diff-chg">
add
an
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
and
</ins>
set
<ins class="diff-new">its
value
</ins>
to
<del class="diff-old">blankNodeIdentifer
.
</del>
<ins class="diff-chg">the
language
code
associated
with
the
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
;
unless
the
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
is
set
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
in
which
case
no
member
is
added.
</ins></li><li><ins class="diff-chg">
Otherwise,
if
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
has
a
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins></a>,<ins class="diff-chg">
add
an
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
and
set
its
value
to
the
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins></a>.</li></ol>
</li>
<li>
Return
<del class="diff-old">blankNodeIdentifier
.
</del>
<i>
<ins class="diff-chg">result
</ins></i>.
</li>
</ol>
</section>
</section>
</section>
<section id="compaction-algorithms">
<h2>
<span class="secno">
<ins class="diff-new">8.
</ins></span><ins class="diff-new">
Compaction
Algorithms
</ins></h2>
<section id="compaction-algorithm">
<h3>
<span class="secno">
<del class="diff-old">5.8
</del>
<ins class="diff-chg">8.1
</ins>
</span>
Compaction
Algorithm
</h3>
<p>
<ins class="diff-new">This
algorithm
compacts
a
JSON-LD
document,
such
that
the
given
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-new">
context
</ins></a><ins class="diff-new">
is
applied.
This
must
result
in
shortening
any
applicable
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><ins class="diff-new">
IRIs
</ins></a><ins class="diff-new">
to
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
terms
</ins></a><ins class="diff-new">
or
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-new">
compact
IRIs
</ins></a>,<ins class="diff-new">
any
applicable
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-new">
keywords
</ins></a><ins class="diff-new">
to
</ins><a href="#dfn-keyword-alias" title="keyword-alias" class="tref internalDFN"><ins class="diff-new">
keyword
aliases
</ins></a>,<ins class="diff-new">
and
any
applicable
</ins><a href="#dfn-json-ld-value" title="json-ld-value" class="tref internalDFN"><ins class="diff-new">
JSON-LD
values
</ins></a><ins class="diff-new">
expressed
in
</ins><a href="#dfn-expanded-form" title="expanded-form" class="tref internalDFN"><ins class="diff-new">
expanded
form
</ins></a><ins class="diff-new">
to
simple
values
such
as
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-new">
strings
</ins></a><ins class="diff-new">
or
</ins><a href="#dfn-number" title="number" class="tref internalDFN"><ins class="diff-new">
numbers
</ins></a>.</p><section class="informative"><h4 id="general-solution-5"><ins class="diff-new">
General
Solution
</ins></h4><p><em><ins class="diff-new">
This
section
is
non-normative.
</ins></em></p><p><ins class="diff-new">
Starting
with
its
root
</ins><i><ins class="diff-new">
element
</ins></i>,<ins class="diff-new">
we
can
process
the
JSON-LD
document
recursively,
until
we
have
a
fully
</ins><a href="#dfn-compaction" title="compaction" class="tref internalDFN"><ins class="diff-new">
compacted
</ins></a><i><ins class="diff-new">
result
</ins></i>.<ins class="diff-new">
When
</ins><a href="#dfn-compaction" title="compaction" class="tref internalDFN"><ins class="diff-new">
compacting
</ins></a><ins class="diff-new">
an
</ins><i><ins class="diff-new">
element
</ins></i>,<ins class="diff-new">
we
can
treat
each
one
differently
according
to
its
type,
in
order
to
break
down
the
problem:
</ins></p><ol><li><ins class="diff-new">
If
the
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
is
a
</ins><a href="#dfn-scalar" title="scalar" class="tref internalDFN"><ins class="diff-new">
scalar
</ins></a>,<ins class="diff-new">
it
is
already
in
</ins><a href="#dfn-compacted-form" title="compacted-form" class="tref internalDFN"><ins class="diff-new">
compacted
form
</ins></a>,<ins class="diff-new">
so
we
simply
return
it.
</ins></li><li><ins class="diff-new">
If
the
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
is
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>,<ins class="diff-new">
we
compact
each
of
its
items
recursively
and
return
them
in
a
new
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>.</li><li><ins class="diff-new">
Otherwise
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a>.<ins class="diff-new">
The
value
of
each
key
in
element
is
compacted
recursively.
Some
of
the
keys
will
be
compacted,
using
the
</ins><a href="#iri-compaction"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
Compaction
algorithm
</ins></a>,<ins class="diff-new">
to
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
terms
</ins></a><ins class="diff-new">
or
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-new">
compact
IRIs
</ins></a><ins class="diff-new">
and
others
will
be
compacted
from
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-new">
keywords
</ins></a><ins class="diff-new">
to
</ins><a href="#dfn-keyword-alias" title="keyword-alias" class="tref internalDFN"><ins class="diff-new">
keyword
aliases
</ins></a><ins class="diff-new">
or
simply
left
unchanged
because
they
do
not
have
definitions
in
the
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-new">
context
</ins></a>.<ins class="diff-new">
Values
will
be
converted
to
</ins><a href="#dfn-compacted-form" title="compacted-form" class="tref internalDFN"><ins class="diff-new">
compacted
form
</ins></a><ins class="diff-new">
via
the
</ins><a href="#value-compaction"><ins class="diff-new">
Value
Compaction
algorithm
</ins></a>.<ins class="diff-new">
Some
data
will
be
reshaped
based
on
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-new">
container
mappings
</ins></a><ins class="diff-new">
specified
in
the
context
such
as
</ins><code><ins class="diff-new">
@index
</ins></code><ins class="diff-new">
or
</ins><code><ins class="diff-new">
@language
</ins></code><ins class="diff-new">
maps.
</ins></li></ol><p><ins class="diff-new">
The
final
output
is
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
with
a
</ins><code><ins class="diff-new">
@context
</ins></code><ins class="diff-new">
key,
if
a
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-new">
context
</ins></a><ins class="diff-new">
was
given,
where
the
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
is
either
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
or
a
wrapper
for
it
where
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
appears
as
the
value
of
an
(aliased)
</ins><code><ins class="diff-new">
@graph
</ins></code><ins class="diff-new">
key
because
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
contained
two
or
more
items
in
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>.</p></section><section><h4 id="algorithm-5"><ins class="diff-new">
Algorithm
</ins></h4><p>
The
algorithm
takes
<del class="diff-old">four
</del>
<ins class="diff-chg">five
required
</ins>
input
variables:
an
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
an
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
</a>,
an
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>,
<del class="diff-old">and
</del>
an
<i>
element
</i>
to
be
<del class="diff-old">compacted.
</del>
<ins class="diff-chg">compacted,
and
a
flag
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays"><ins class="diff-chg">
compactArrays
</ins></a></code>.
To
begin,
the
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>
is
set
to
the
result
of
performing
<a href="#context-processing-algorithm">
Context
Processing
</a>
on
the
passed
<a href="#dfn-context" title="context" class="tref internalDFN">
context
<del class="diff-old">,
</del>
</a>,
<ins class="diff-chg">the
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
</a>
is
set
to
the
result
of
<del class="diff-old">creating
an
inverse
context
from
</del>
<ins class="diff-chg">performing
</ins>
the
<a href="#inverse-context-creation">
<ins class="diff-chg">Inverse
Context
Creation
algorithm
</ins></a><ins class="diff-chg">
on
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<ins class="diff-chg">the
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
is
set
to
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>,
<del class="diff-old">and
</del>
<i>
element
</i>
is
set
to
the
result
of
performing
the
<a href="#expansion-algorithm">
Expansion
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins>
</a>
on
the
<a href="#dfn-json-ld-input" title="json-ld-input" class="tref internalDFN">
JSON-LD
input
</a>,
<ins class="diff-new">and,
if
not
passed,
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays"><ins class="diff-new">
compactArrays
</ins></a></code><ins class="diff-new">
is
set
to
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-new">
true
</ins>
</a>.
</p>
<ol class="algorithm">
<li>
If
<i>
element
</i>
<ins class="diff-chg">is
a
</ins><a href="#dfn-scalar" title="scalar" class="tref internalDFN"><ins class="diff-chg">
scalar
</ins></a>,<ins class="diff-chg">
it
is
already
in
its
most
compact
form,
so
simply
return
</ins><i><ins class="diff-chg">
element
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
element
</ins></i>
is
an
<a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">,
</del>
</a>:
<ol class="algorithm">
<li>
Initialize
<del class="diff-old">a
new
</del>
<i>
<ins class="diff-chg">result
</ins></i><ins class="diff-chg">
to
an
</ins>
empty
<a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">result
.
</del>
</a>.
</li>
<li>
<del class="diff-old">Process
</del>
<ins class="diff-chg">For
</ins>
each
<i>
item
</i>
in
<i>
element
<del class="diff-old">recursively
</del>
</i>:
<ol class="algorithm">
<li>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
compacted
item
</ins></i><ins class="diff-chg">
to
the
result
of
</ins>
using
this
<del class="diff-old">algorithm,
</del>
<ins class="diff-chg">algorithm
recursively,
</ins>
passing
<del class="diff-old">a
copy
of
the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
</a>,
<del class="diff-old">and
the
</del>
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
<del class="diff-old">.
Add
each
</del>
</a>,
<ins class="diff-chg">and
em&gt;item
for
</ins><i><ins class="diff-chg">
element
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i>
compacted
item
<del class="diff-old">to
result
unless
it
</del>
</i>
is
<ins class="diff-chg">not
</ins><a href="#dfn-null" title="null" class="tref internalDFN">
null
<del class="diff-old">.
</del>
</a>,
<ins class="diff-chg">then
append
it
to
</ins><i><ins class="diff-chg">
result
</ins></i>.</li></ol>
</li>
<li>
If
<i>
result
</i>
<ins class="diff-chg">contains
only
one
item
(it
</ins>
has
a
<del class="diff-old">single
item
</del>
<ins class="diff-chg">length
of
</ins><code><ins class="diff-chg">
1
</ins></code><ins class="diff-chg">
),
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
has
no
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,
and
<del class="diff-old">the
</del>
<code class="idlMemberName">
<a href="#widl-JsonLdOptions-compactArrays">
compactArrays
</a>
</code>
<del class="diff-old">option
</del>
is
<a href="#dfn-true" title="true" class="tref internalDFN">
<ins class="diff-new">true
</ins></a>,
set
<i>
<ins class="diff-new">result
</ins></i>
to
<del class="diff-old">true
,
return
that
item;
otherwise
return
</del>
<ins class="diff-chg">its
only
item.
</ins></li><li><ins class="diff-chg">
Return
</ins><i>
result
<del class="diff-old">.
</del>
</i>.
</li>
</ol>
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Otherwise
</ins><i>
element
</i>
is
<del class="diff-old">not
</del>
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
<del class="diff-old">it
is
already
in
compact
form,
return
it
as
is.
</del>
</a>.
</li>
<li>
If
<i>
element
</i>
has
an
<code>
@value
</code>
or
<code>
@id
</code>
<del class="diff-old">member,
replace
element
with
</del>
<ins class="diff-chg">member
and
</ins>
the
result
of
<ins class="diff-new">using
</ins>
the
<a href="#value-compaction">
Value
Compaction
algorithm
<del class="diff-old">.
If
the
updated
</del>
</a>,
<ins class="diff-chg">passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a>,<a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>,and<i>
element
</i>
<ins class="diff-chg">as
</ins><i><ins class="diff-chg">
value
</ins></i>
is
a
<a href="#dfn-scalar" title="scalar" class="tref internalDFN">
scalar
</a>,
return
<del class="diff-old">it
as
it
cannot
be
further
compacted.
</del>
<ins class="diff-chg">that
result.
</ins>
</li>
<li>
Initialize
<del class="diff-old">a
new
</del>
<i>
<ins class="diff-chg">inside
reverse
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
if
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
equals
</ins><code><ins class="diff-chg">
@reverse
</ins></code>,<ins class="diff-chg">
otherwise
to
</ins><a href="#dfn-false" title="false" class="tref internalDFN"><ins class="diff-chg">
false
</ins></a>.</li><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
to
an
</ins>
empty
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
<del class="diff-old">result.
</del>
</a>.
</li>
<li>
<del class="diff-old">Process
</del>
<ins class="diff-chg">For
</ins>
each
<ins class="diff-chg">key
</ins><i><ins class="diff-chg">
expanded
</ins>
property
</i>
and
value
<i>
<ins class="diff-chg">expanded
value
</ins></i>
in
<i>
element
</i>,
ordered
<ins class="diff-new">lexicographically
</ins>
by
<i>
<ins class="diff-chg">expanded
</ins>
property
<del class="diff-old">as
follows:
</del>
</i>:
<ol class="algorithm">
<li>
If
<i>
<ins class="diff-chg">expanded
</ins>
property
</i>
is
<del class="diff-old">a
JSON-LD
keyword
and
property
equals
</del>
<code>
@id
<del class="diff-old">,
compact
</del>
</code>
<ins class="diff-chg">or
</ins><code><ins class="diff-chg">
@type
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
</ins>
value
<del class="diff-old">according
</del>
</i>
<ins class="diff-chg">is
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a>,<ins class="diff-chg">
then
initialize
</ins><i><ins class="diff-chg">
compacted
value
</ins></i><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">rules
</del>
<ins class="diff-chg">result
</ins>
of
<ins class="diff-new">using
</ins>
the
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
algorithm
<del class="diff-old">.
Otherwise,
</del>
</a>,
<ins class="diff-chg">passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a>,<i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
iri
</ins></i>,<ins class="diff-chg">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
vocab
</ins></i>
if
<i>
<ins class="diff-chg">expanded
</ins>
property
<del class="diff-old">equals
</del>
</i>
<ins class="diff-chg">is
</ins>
<code>
@type
</code>,
<del class="diff-old">compact
</del>
<a href="#dfn-false" title="false" class="tref internalDFN">
<ins class="diff-chg">false
</ins></a><ins class="diff-chg">
otherwise.
</ins></li><li><ins class="diff-chg">
Otherwise,
</ins><i><ins class="diff-chg">
expanded
</ins>
value
<del class="diff-old">(or
each
item
of
</del>
</i>
<ins class="diff-chg">must
be
a
</ins><code><ins class="diff-chg">
@type
</ins></code><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
compacted
</ins>
value
<del class="diff-old">if
it
is
</del>
</i>
<ins class="diff-chg">to
</ins>
an
<ins class="diff-chg">empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">)
according
</del>
</a>.
</li>
<li>
<ins class="diff-chg">For
each
item
</ins><i><ins class="diff-chg">
expanded
type
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
expanded
value
</ins></i>,<ins class="diff-chg">
append
</ins>
the
<del class="diff-old">rules
</del>
<ins class="diff-chg">result
of
</ins>
of
<ins class="diff-new">using
</ins>
the
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
algorithm
</a>,
<ins class="diff-new">passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-new">
inverse
context
</ins></a>,<i><ins class="diff-new">
expanded
type
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
iri
</ins></i>,<ins class="diff-new">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-new">
true
</ins>
</a>
<del class="diff-old">with
the
vocabRelative
flag
set
</del>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,
to
<del class="diff-old">true
.
</del>
<i>
<ins class="diff-chg">compacted
value
</ins></i>.</li><li>
If
<i>
<ins class="diff-chg">compacted
</ins>
value
<del class="diff-old">is
an
array
consisting
of
just
</del>
</i>
<ins class="diff-chg">contains
only
</ins>
one
<del class="diff-old">item,
replace
</del>
<ins class="diff-chg">item
(it
has
a
length
of
</ins><code><ins class="diff-chg">
1
</ins></code><ins class="diff-chg">
),
then
set
</ins><i><ins class="diff-chg">
compacted
</ins>
value
<del class="diff-old">with
that
</del>
</i>
<ins class="diff-chg">to
its
only
</ins>
item.
</li>
</ol>
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
alias
</ins></i><ins class="diff-chg">
to
the
result
of
using
the
</ins><a href="#iri-compaction"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Compaction
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
expanded
</ins>
property
<del class="diff-old">equals
</del>
</i>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
iri
</ins></i>.</li><li><ins class="diff-chg">
Add
a
member
</ins><i><ins class="diff-chg">
alias
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
whose
value
is
set
to
</ins><i><ins class="diff-chg">
compacted
value
</ins></i><ins class="diff-chg">
and
continue
to
the
next
</ins><i><ins class="diff-chg">
expanded
property
</ins></i>.</li></ol></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
is
</ins>
<code>
<del class="diff-old">@graph
,
compact
</del>
<ins class="diff-chg">@reverse
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
compacted
</ins>
value
<del class="diff-old">by
recursively
invoking
</del>
</i>
<ins class="diff-chg">to
the
result
of
using
</ins>
this
<del class="diff-old">algorithm,
</del>
<ins class="diff-chg">algorithm
recursively,
</ins>
passing
<del class="diff-old">a
copy
of
the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
</a>,
<code>
<ins class="diff-new">@reverse
</ins></code><ins class="diff-new">
for
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>,
and
<i>
<ins class="diff-chg">expanded
value
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
element
</ins></i>.</li><li><ins class="diff-chg">
For
each
</ins><i>
property
<del class="diff-old">as
active
</del>
</i>
<ins class="diff-chg">and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
compacted
value
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
If
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
for
</ins><i>
property
</i>
<ins class="diff-new">in
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins>
</a>
<del class="diff-old">ensuring
</del>
<ins class="diff-chg">indicates
</ins>
that
<i>
<ins class="diff-new">property
</ins></i><ins class="diff-new">
is
a
</ins><a href="#dfn-reverse-property" title="reverse-property" class="tref internalDFN"><ins class="diff-new">
reverse
property
</ins></a><ol class="algorithm"><li><ins class="diff-new">
If
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays"><ins class="diff-new">
compactArrays
</ins></a></code><ins class="diff-new">
is
</ins><a href="#dfn-false" title="false" class="tref internalDFN"><ins class="diff-new">
false
</ins></a><ins class="diff-new">
and
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>,<ins class="diff-new">
set
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
to
a
new
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a><ins class="diff-new">
containing
only
</ins><i><ins class="diff-new">
value
</ins></i>.</li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
property
</ins></i><ins class="diff-new">
is
not
a
member
of
</ins><i><ins class="diff-new">
result
</ins></i>,<ins class="diff-new">
add
one
and
set
its
value
to
</ins><i><ins class="diff-new">
value
</ins></i>.</li><li><ins class="diff-new">
Otherwise,
if
</ins>
the
<ins class="diff-new">value
of
the
</ins><i><ins class="diff-new">
property
</ins></i><ins class="diff-new">
member
of
</ins><i>
result
</i>
is
<ins class="diff-new">not
</ins>
an
<a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">.
</del>
</a>,
<ins class="diff-chg">set
it
to
a
new
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
containing
only
the
value.
Then
append
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
to
its
value
if
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
otherwise
append
each
of
its
items.
</ins>
</li>
<li>
<del class="diff-old">Set
active
</del>
<ins class="diff-chg">Remove
the
</ins><i>
property
</i>
<ins class="diff-chg">member
from
</ins><i><ins class="diff-chg">
compacted
value
</ins></i>.</li></ol></li></ol></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
compacted
value
</ins></i><ins class="diff-chg">
has
some
remaining
members,
i.e.,
it
is
not
an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
alias
</ins></i>
to
the
result
of
<del class="diff-old">performing
</del>
<ins class="diff-chg">using
the
</ins><a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
<del class="diff-old">on
property
.
</del>
<ins class="diff-chg">algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a>,<ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
@reverse
</ins></code><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
iri
</ins></i>.
</li>
<li>
Set
the
<del class="diff-old">active
property
</del>
<ins class="diff-chg">value
of
the
</ins><i><ins class="diff-chg">
alias
</ins></i>
member
of
<i>
result
</i>
to
<i>
<ins class="diff-chg">compacted
</ins>
value
<del class="diff-old">.
Continue
</del>
</i>
<ins class="diff-chg">and
continue
</ins>
with
the
next
<i>
<ins class="diff-chg">expanded
</ins>
property
<del class="diff-old">-
value
pair
</del>
</i>
from
<i>
element
<del class="diff-old">.
</del>
</i>.
</li>
</ol>
</li>
</ol>
</li>
<li>
If
<del class="diff-old">value
</del>
<i>
<ins class="diff-chg">expanded
property
</ins></i>
is
<del class="diff-old">an
empty
array
,
set
</del>
<code>
<ins class="diff-chg">@index
</ins></code><ins class="diff-chg">
and
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
<ins class="diff-new">has
a
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-new">
container
mapping
</ins></a><ins class="diff-new">
in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a><ins class="diff-new">
that
is
</ins><code><ins class="diff-new">
@index
</ins></code>,<ins class="diff-new">
then
the
compacted
result
will
be
inside
of
an
</ins><code><ins class="diff-new">
@index
</ins></code><ins class="diff-new">
container,
drop
the
</ins><code><ins class="diff-new">
@index
</ins></code><ins class="diff-new">
property
by
continuing
to
the
next
</ins><i><ins class="diff-new">
expanded
property
</ins></i>.</li><li><ins class="diff-new">
Otherwise,
if
</ins><i><ins class="diff-new">
expanded
property
</ins></i><ins class="diff-new">
is
</ins><code><ins class="diff-new">
@index
</ins></code>,<code><ins class="diff-new">
@value
</ins></code>,<ins class="diff-new">
or
</ins><code><ins class="diff-new">
@language
</ins></code>:<ol class="algorithm"><li><ins class="diff-new">
Initialize
</ins><i><ins class="diff-new">
alias
</ins></i>
to
the
result
of
<del class="diff-old">performing
</del>
<ins class="diff-chg">using
the
</ins><a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
<del class="diff-old">on
</del>
<ins class="diff-chg">algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
expanded
</ins>
property
<del class="diff-old">with
the
vocabRelative
flag
</del>
</i>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
iri
</ins></i>.</li><li><ins class="diff-chg">
Add
a
member
</ins><i><ins class="diff-chg">
alias
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
whose
value
is
</ins>
set
to
<del class="diff-old">true
.
</del>
<i>
<ins class="diff-chg">expanded
value
</ins></i><ins class="diff-chg">
and
continue
with
the
next
</ins><i><ins class="diff-chg">
expanded
property
</ins></i>.</li></ol>
</li>
<li>
If
<del class="diff-old">active
property
is
a
JSON
object
,
i.e.,
it
</del>
<i>
<ins class="diff-chg">expanded
value
</ins></i>
is
<del class="diff-old">a
property
generator
,
set
</del>
<ins class="diff-chg">an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
item
</ins>
active
property
</i>
to
the
result
of
<del class="diff-old">performing
</del>
<ins class="diff-chg">using
</ins>
the
<del class="diff-old">Find
and
Remove
Property
Generator
Duplicates
</del>
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Compaction
</ins>
algorithm
</a>,
passing
<del class="diff-old">element
,
property
,
null
for
value,
the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<del class="diff-old">and
active
</del>
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
<ins class="diff-chg">inverse
context
</ins></a>,<i><ins class="diff-chg">
expanded
</ins>
property
<del class="diff-old">.
</del>
</i>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
iri
</ins></i>,<i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
value
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
inside
reverse
</ins></i>.
</li>
<li>
<del class="diff-old">Ensure
that
</del>
<ins class="diff-chg">If
</ins><i>
result
<del class="diff-old">has
an
</del>
</i>
<ins class="diff-chg">does
not
have
the
key
that
equals
</ins><i><ins class="diff-chg">
item
</ins>
active
property
<del class="diff-old">member;
if
not
create
it
and
</del>
</i>,
set
<del class="diff-old">its
</del>
<ins class="diff-chg">this
key's
</ins>
value
<ins class="diff-new">in
</ins><i><ins class="diff-new">
result
</ins></i>
to
an
empty
<a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>.
<del class="diff-old">Continue
with
</del>
<ins class="diff-chg">Otherwise,
if
</ins>
the
<del class="diff-old">next
property
-
</del>
<ins class="diff-chg">key's
</ins>
value
<del class="diff-old">pair
from
element
.
</del>
<ins class="diff-chg">is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
then
set
it
to
one
containing
only
the
value.
</ins>
</li>
</ol>
</li>
<li>
<del class="diff-old">Otherwise
perform
</del>
<ins class="diff-chg">At
this
point,
</ins><i><ins class="diff-chg">
expanded
value
</ins></i><ins class="diff-chg">
must
be
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
due
to
</ins>
the
<del class="diff-old">following
steps
for
</del>
<a href="#expansion-algorithm">
<ins class="diff-chg">Expansion
algorithm
</ins></a>.<ins class="diff-chg">
For
</ins>
each
item
<del class="diff-old">of
</del>
<i>
<ins class="diff-chg">expanded
item
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
expanded
</ins>
value
<del class="diff-old">:
</del>
</i>:
<ol class="algorithm">
<li>
<del class="diff-old">Set
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
item
</ins>
active
property
</i>
to
the
result
of
<del class="diff-old">performing
</del>
<ins class="diff-chg">using
the
</ins><a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
<ins class="diff-new">algorithm
</ins></a>,<ins class="diff-new">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-new">
inverse
context
</ins></a>,<i><ins class="diff-new">
expanded
property
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
iri
</ins></i>,<i><ins class="diff-new">
expanded
item
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
value
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-new">
true
</ins>
</a>
<del class="diff-old">on
</del>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
inside
reverse
</ins></i>.</li><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
container
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>.<ins class="diff-chg">
If
there
is
a
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
item
active
</ins>
property
<del class="diff-old">with
the
vocabRelative
flag
</del>
</i>
<ins class="diff-chg">in
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,
set
<i>
<ins class="diff-new">container
</ins></i>
to
<del class="diff-old">true
.
</del>
<ins class="diff-chg">its
value.
</ins>
</li>
<li>
<del class="diff-old">If
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
compacted
item
</ins></i><ins class="diff-chg">
to
the
result
of
using
this
algorithm
recursively,
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a>,<i><ins class="diff-chg">
item
</ins>
active
property
</i>
<ins class="diff-chg">for
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>,<i><ins class="diff-chg">
expanded
item
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
if
it
does
not
contain
the
key
</ins><code><ins class="diff-chg">
@list
</ins></code>,<ins class="diff-chg">
otherwise
pass
the
key's
associated
value
for
</ins><i><ins class="diff-chg">
element
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
expanded
item
</ins></i>
is
a
<del class="diff-old">JSON
</del>
<a href="#dfn-list-object" title="list-object" class="tref internalDFN">
<ins class="diff-chg">list
</ins>
object
</a>:
<ol class="algorithm">
<li>
<ins class="diff-new">If
</ins><i><ins class="diff-new">
compacted
item
</ins></i><ins class="diff-new">
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins>
</a>,
<del class="diff-old">i.e.,
</del>
<ins class="diff-chg">then
set
</ins>
it
<ins class="diff-new">to
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a><ins class="diff-new">
containing
only
</ins><i><ins class="diff-new">
compacted
item
</ins></i>.</li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
container
</ins></i>
is
<ins class="diff-new">not
</ins><code><ins class="diff-new">
@list
</ins></code>:<ol class="algorithm"><li><ins class="diff-new">
Convert
</ins><i><ins class="diff-new">
compacted
item
</ins></i><ins class="diff-new">
to
</ins>
a
<del class="diff-old">property
generator
,
set
active
property
</del>
<a href="#dfn-list-object" title="list-object" class="tref internalDFN">
<ins class="diff-chg">list
object
</ins>
</a>
<ins class="diff-new">by
setting
it
</ins>
to
<ins class="diff-new">a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
containing
key-value
pair
where
the
key
is
</ins>
the
result
of
<del class="diff-old">performing
</del>
the
<del class="diff-old">Find
and
Remove
Property
Generator
Duplicates
</del>
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Compaction
</ins>
algorithm
</a>,
passing
<del class="diff-old">element
,
property
,
item
,
the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
<ins class="diff-new">inverse
context
</ins></a>,<code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
for
</ins><i><ins class="diff-new">
iri
</ins></i>,
and
<del class="diff-old">active
property
.
</del>
<i>
<ins class="diff-chg">compacted
item
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
value
</ins></i>.
</li>
<li>
If
<i>
<ins class="diff-new">expanded
item
</ins></i><ins class="diff-new">
contains
</ins>
the
<ins class="diff-chg">key
</ins><code><ins class="diff-chg">
@index
</ins></code>,<ins class="diff-chg">
then
add
a
key-value
pair
to
</ins><i><ins class="diff-chg">
compacted
item
</ins></i><ins class="diff-chg">
where
the
key
is
the
result
of
the
</ins><a href="#iri-compaction"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
Compaction
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
<del class="diff-old">property's
</del>
<ins class="diff-chg">context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a>,<code><ins class="diff-chg">
@index
</ins></code><ins class="diff-chg">
as
</ins><i><ins class="diff-chg">
iri
</ins></i>,<ins class="diff-chg">
and
the
associated
with
the
</ins><code><ins class="diff-chg">
@index
</ins></code><ins class="diff-chg">
key
in
</ins><i><ins class="diff-chg">
expanded
item
</ins></i><ins class="diff-chg">
as
</ins><i><ins class="diff-chg">
value
</ins></i>.</li></ol></li><li><ins class="diff-chg">
Otherwise,
</ins><i><ins class="diff-chg">
item
active
property
</ins></i><ins class="diff-chg">
must
not
be
a
key
in
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
because
there
cannot
be
two
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-chg">
list
objects
</ins>
</a>
<ins class="diff-chg">associated
with
an
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
that
has
a
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
container
mapping
</a>
<del class="diff-old">is
set
</del>
<ins class="diff-chg">;
a
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.compaction-to-list-of-lists"><ins class="diff-chg">
compaction
</ins>
to
<ins class="diff-new">list
of
lists
</ins></a></code><ins class="diff-new">
error
has
been
detected
and
processing
is
aborted.
</ins></li></ol></li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
container
</ins></i><ins class="diff-new">
is
</ins>
<code>
@language
</code>
or
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@index
</ins></code>:
<ol class="algorithm">
<li>
<del class="diff-old">Unless
result
has
already
an
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
item
</ins>
active
property
<del class="diff-old">member,
create
one
and
</del>
</i>
<ins class="diff-chg">is
a
key
in
</ins><i><ins class="diff-chg">
result
</ins></i>,<ins class="diff-chg">
then
</ins>
initialize
<i>
<ins class="diff-new">map
object
</ins></i><ins class="diff-new">
to
</ins>
its
<del class="diff-old">value
</del>
<ins class="diff-chg">associated
value,
otherwise
initialize
it
</ins>
to
an
empty
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>.
<del class="diff-old">This
object
</del>
</li>
<li>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
container
</ins></i>
is
<del class="diff-old">called
mapObject
.
</del>
<code>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
compacted
item
</ins></i><ins class="diff-chg">
contains
the
key
</ins><code><ins class="diff-chg">
@value
</ins></code>,<ins class="diff-chg">
then
set
</ins><i><ins class="diff-chg">
compacted
item
</ins></i><ins class="diff-chg">
to
the
value
associated
with
its
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
key.
</ins>
</li>
<li>
<del class="diff-old">Set
index
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
map
key
</ins></i>
to
the
value
<del class="diff-old">of
</del>
<ins class="diff-chg">associated
with
with
the
key
that
equals
</ins><i><ins class="diff-chg">
container
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
expanded
item
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
map
key
</ins></i><ins class="diff-chg">
is
not
a
key
in
</ins><i><ins class="diff-chg">
map
object
</ins></i>,<ins class="diff-chg">
then
set
this
key's
value
in
</ins><i><ins class="diff-chg">
map
object
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
compacted
item
</ins></i>.<ins class="diff-chg">
Otherwise,
if
the
value
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
then
set
it
to
one
containing
only
</ins>
the
<ins class="diff-new">value
and
then
append
</ins><i><ins class="diff-new">
compacted
item
</ins></i><ins class="diff-new">
to
it.
</ins></li></ol></li><li><ins class="diff-new">
Otherwise,
</ins><ol class="algorithm"><li><ins class="diff-new">
If
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays"><ins class="diff-new">
compactArrays
</ins></a></code><ins class="diff-new">
is
</ins><a href="#dfn-false" title="false" class="tref internalDFN"><ins class="diff-new">
false
</ins></a>,<i><ins class="diff-new">
container
</ins></i><ins class="diff-new">
is
</ins>
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@set
</ins>
</code>
or
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@list
</ins></code>,<ins class="diff-chg">
or
</ins><i><ins class="diff-chg">
expanded
property
</ins></i><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@list
</ins>
</code>
<del class="diff-old">member
of
</del>
<ins class="diff-chg">or
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
compacted
</ins>
item
<del class="diff-old">(depending
on
</del>
</i>
<ins class="diff-chg">is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
set
it
to
a
new
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
containing
only
</ins><i><ins class="diff-chg">
compacted
item
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
item
active
property
</ins></i><ins class="diff-chg">
is
not
a
key
in
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
then
add
the
key-value
pair,
(
</ins><i><ins class="diff-chg">
item
active
property
</ins></i><ins class="diff-chg">
-
</ins><i><ins class="diff-chg">
compacted
item
</ins></i><ins class="diff-chg">
),
to
</ins><i><ins class="diff-chg">
result
</ins></i>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins>
the
value
<del class="diff-old">of
</del>
<ins class="diff-chg">associated
with
</ins>
the
<ins class="diff-chg">key
that
equals
</ins><i><ins class="diff-chg">
item
</ins>
active
<del class="diff-old">property's
container
mapping
</del>
<ins class="diff-chg">property
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
set
it
to
a
new
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">).
</del>
<ins class="diff-chg">containing
only
the
value.
Then
append
</ins><i><ins class="diff-chg">
compacted
item
</ins></i><ins class="diff-chg">
to
the
value
if
</ins><i><ins class="diff-chg">
compacted
item
</ins></i><ins class="diff-chg">
is
not
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
otherwise,
concatenate
it.
</ins></li></ol></li></ol></li></ol>
</li>
<li>
<del class="diff-old">First
compact
item
using
</del>
<ins class="diff-chg">Return
</ins><i><ins class="diff-chg">
result
</ins></i>.</li></ol><p><ins class="diff-chg">
If,
after
</ins>
the
<del class="diff-old">Value
Compaction
</del>
algorithm
<del class="diff-old">passing
index
as
containerValue
,
then
compact
</del>
<ins class="diff-chg">outlined
above
is
run,
the
result
</ins><i><ins class="diff-chg">
result
</ins></i><ins class="diff-chg">
is
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>,<ins class="diff-chg">
replace
</ins>
it
<del class="diff-old">by
recursively
invoking
this
algorithm
passing
</del>
<ins class="diff-chg">with
</ins>
a
<del class="diff-old">copy
</del>
<ins class="diff-chg">new
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
with
a
single
member
whose
key
is
the
result
</ins>
of
<ins class="diff-new">using
</ins>
the
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
Compaction
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
</a>,
and
<code>
<ins class="diff-new">@graph
</ins></code><ins class="diff-new">
as
</ins><i><ins class="diff-new">
iri
</ins></i><ins class="diff-new">
and
whose
value
is
</ins>
the
<del class="diff-old">active
property
.
If
no
index
</del>
<a href="#dfn-array" title="array" class="tref internalDFN">
<ins class="diff-chg">array
</ins></a><i><ins class="diff-chg">
result
</ins></i>.<ins class="diff-chg">
Finally,
if
a
</ins><i><ins class="diff-chg">
context
</ins></i><ins class="diff-chg">
has
been
passed,
add
an
</ins><code><ins class="diff-chg">
@context
</ins></code>
member
<del class="diff-old">exists
in
the
mapObject
create
one
</del>
<ins class="diff-chg">to
</ins><i><ins class="diff-chg">
result
</ins></i>
and
set
its
value
to
<del class="diff-old">item
;
otherwise
append
item
to
</del>
the
<del class="diff-old">index
member
(converting
</del>
<ins class="diff-chg">passed
</ins><i><ins class="diff-chg">
context
</ins></i>.</p></section></section><section id="inverse-context-creation"><h3><span class="secno"><ins class="diff-chg">
8.2
</ins></span><ins class="diff-chg">
Inverse
Context
Creation
</ins></h3><p><ins class="diff-chg">
When
there
is
more
than
one
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
that
could
be
chosen
to
compact
an
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>,
it
<ins class="diff-new">has
to
be
ensured
that
the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
selection
is
both
deterministic
and
represents
the
most
context-appropriate
choice
whilst
taking
into
consideration
algorithmic
complexity.
</ins></p><p><ins class="diff-new">
In
order
</ins>
to
<ins class="diff-new">make
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
selections,
the
concept
of
</ins>
an
<del class="diff-old">array
</del>
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
<ins class="diff-chg">inverse
context
</ins></a><ins class="diff-chg">
is
introduced.
An
</ins><dfn id="dfn-inverse-context" title="inverse-context"><ins class="diff-chg">
inverse
context
</ins></dfn><ins class="diff-chg">
is
essentially
a
reverse
lookup
table
that
maps
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mappings
</ins></a>,<a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mappings
</ins></a>,<ins class="diff-chg">
and
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mappings
</ins></a><ins class="diff-chg">
to
a
simple
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
for
a
given
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>.<ins class="diff-chg">
A
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a><ins class="diff-chg">
only
needs
to
be
generated
for
an
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>
if
it
is
<del class="diff-old">not
one
already).
Continue
with
</del>
<ins class="diff-chg">being
used
for
</ins><a href="#dfn-compaction" title="compaction" class="tref internalDFN"><ins class="diff-chg">
compaction
</ins></a>.</p><p><ins class="diff-chg">
To
make
use
of
an
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a>,<ins class="diff-chg">
a
list
of
preferred
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mappings
</ins></a><ins class="diff-chg">
and
</ins>
the
<del class="diff-old">next
property
-
</del>
<a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
<ins class="diff-chg">type
mapping
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
are
gathered
for
a
particular
</ins>
value
<del class="diff-old">pair
from
element
.
If
</del>
<ins class="diff-chg">associated
with
an
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.<ins class="diff-chg">
These
parameters
are
then
fed
to
the
</ins><a href="#term-selection"><ins class="diff-chg">
Term
Selection
algorithm
</ins></a>,<ins class="diff-chg">
which
will
find
the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
that
most
appropriately
matches
the
value's
mappings.
</ins></p><section class="informative"><h4 id="general-solution-6"><ins class="diff-chg">
General
Solution
</ins></h4><p>
<em>
<del class="diff-old">item
</del>
<ins class="diff-chg">This
section
</ins>
is
<del class="diff-old">a
JSON
object
</del>
<ins class="diff-chg">non-normative.
</ins></em></p><p><ins class="diff-chg">
To
create
an
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins>
</a>
<del class="diff-old">having
</del>
<ins class="diff-chg">for
</ins>
a
<del class="diff-old">@list
member,
compact
</del>
<ins class="diff-chg">given
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>,<ins class="diff-chg">
each
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
in
</ins>
the
<del class="diff-old">value
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-chg">active
context
</ins></a><ins class="diff-chg">
is
visited,
ordered
by
length,
shortest
first
(ties
are
broken
by
choosing
the
lexicographically
least
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
).
For
each
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a>,<ins class="diff-chg">
an
entry
is
added
to
the
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a><ins class="diff-chg">
for
each
possible
combination
</ins>
of
<a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
<ins class="diff-new">container
mapping
</ins></a><ins class="diff-new">
and
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-new">
type
mapping
</ins></a><ins class="diff-new">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-new">
language
mapping
</ins></a>
that
<del class="diff-old">member
by
recursively
invoking
this
algorithm
passing
</del>
<ins class="diff-chg">would
legally
match
the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a>.<ins class="diff-chg">
Illegal
matches
include
differences
between
</ins>
a
<del class="diff-old">copy
</del>
<ins class="diff-chg">value's
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
and
that
</ins>
of
the
<del class="diff-old">active
context
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins></a>.<ins class="diff-chg">
If
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
has
no
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins>
</a>,
<a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
<ins class="diff-chg">type
mapping
</ins></a>,<ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
(or
some
combination
of
these),
then
it
will
have
an
entry
in
the
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
<del class="diff-old">,
</del>
</a>
<ins class="diff-chg">using
the
special
key
</ins><code><ins class="diff-chg">
@none
</ins></code>.<ins class="diff-chg">
This
allows
the
</ins><a href="#term-selection"><ins class="diff-chg">
Term
Selection
algorithm
</ins></a><ins class="diff-chg">
to
fall
back
to
choosing
more
generic
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
when
a
more
specifically-matching
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
is
not
available
for
a
particular
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>
and
<ins class="diff-new">value
combination.
</ins></p></section><section><h4 id="algorithm-6"><ins class="diff-new">
Algorithm
</ins></h4><p><ins class="diff-new">
The
algorithm
takes
one
required
input:
</ins>
the
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
<del class="diff-old">property
</del>
<ins class="diff-chg">context
</ins>
</a>
<del class="diff-old">ensuring
</del>
that
the
<del class="diff-old">result
</del>
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
<ins class="diff-chg">inverse
context
</ins></a>
is
<ins class="diff-new">being
created
for.
</ins></p><ol class="algorithm"><li><ins class="diff-new">
Initialize
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
to
</ins>
an
<del class="diff-old">array
</del>
<ins class="diff-chg">empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins>
</a>.
</li>
<li>
<ins class="diff-new">Initialize
</ins><i><ins class="diff-new">
default
language
</ins></i><ins class="diff-new">
to
</ins><code><ins class="diff-new">
@none
</ins></code>.
If
the
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
<del class="diff-old">property's
container
mapping
</del>
<ins class="diff-chg">context
</ins>
</a>
<del class="diff-old">is
</del>
<ins class="diff-chg">has
a
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins></a>,
set
<i>
<ins class="diff-new">default
language
</ins></i>
to
<del class="diff-old">@list
,
set
</del>
<ins class="diff-chg">it.
</ins></li><li><ins class="diff-chg">
For
each
key
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
and
value
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
in
</ins>
the
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
<del class="diff-old">property
</del>
<ins class="diff-chg">context
</ins></a>,<ins class="diff-chg">
ordered
by
shortest
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins>
</a>
<del class="diff-old">member
of
result
to
</del>
<ins class="diff-chg">first
(breaking
ties
by
choosing
</ins>
the
<del class="diff-old">value
of
item's
@list
member.
</del>
<ins class="diff-chg">lexicographically
least
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
):
</ins><ol class="algorithm"><li>
If
<del class="diff-old">such
an
member
already
exists
in
result,
raise
an
COMPACTION_TO_LIST_OF_LISTS
error;
otherwise
</del>
<ins class="diff-chg">the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
cannot
be
selected
during
</ins><a href="#dfn-compaction" title="compaction" class="tref internalDFN"><ins class="diff-chg">
compaction
</ins></a>,<ins class="diff-chg">
so
</ins>
continue
<del class="diff-old">with
</del>
<ins class="diff-chg">to
</ins>
the
next
<del class="diff-old">property
-
value
pair
from
element
.
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins></a>.
</li>
<li>
<ins class="diff-new">Initialize
</ins><i><ins class="diff-new">
container
</ins></i><ins class="diff-new">
to
</ins><code><ins class="diff-new">
@none
</ins></code>.
If
<del class="diff-old">item
</del>
<ins class="diff-chg">there
</ins>
is
a
<del class="diff-old">JSON
object
</del>
<a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
<ins class="diff-chg">container
mapping
</ins></a><ins class="diff-chg">
in
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins>
</a>,
<del class="diff-old">compact
it
by
recursively
invoking
this
algorithm
passing
a
copy
</del>
<ins class="diff-chg">set
</ins><i><ins class="diff-chg">
container
</ins></i><ins class="diff-chg">
to
its
associated
value.
</ins></li><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
iri
</ins></i><ins class="diff-chg">
to
the
value
</ins>
of
the
<del class="diff-old">active
context
,
inverse
context
,
and
</del>
<a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
for
</ins>
the
<del class="diff-old">active
property
</del>
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins>
</a>.
</li>
<li>
If
<del class="diff-old">no
active
property
</del>
<i>
<ins class="diff-chg">iri
</ins></i><ins class="diff-chg">
is
not
a
key
in
</ins><i><ins class="diff-chg">
result
</ins></i>,<ins class="diff-chg">
add
a
key-value
pair
where
the
key
is
</ins><i><ins class="diff-chg">
iri
</ins></i><ins class="diff-chg">
and
the
value
is
an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins>
</a>
<ins class="diff-new">to
</ins><i><ins class="diff-new">
result
</ins></i>.</li><li><ins class="diff-new">
Reference
the
value
associated
with
the
</ins><i><ins class="diff-new">
iri
</ins></i>
member
<del class="diff-old">exists
</del>
in
<i>
result
</i>
<ins class="diff-chg">using
the
variable
</ins><i><ins class="diff-chg">
container
map
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
container
</ins></i><ins class="diff-chg">
has
no
</ins><i><ins class="diff-chg">
container
map
</ins></i><ins class="diff-chg">
member,
</ins>
create
one
and
set
its
value
to
<del class="diff-old">item
;
otherwise
append
item
to
the
active
property
</del>
<ins class="diff-chg">a
new
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins>
</a>
<ins class="diff-new">with
two
members.
The
first
</ins>
member
<del class="diff-old">(converting
it
to
an
array
if
it
</del>
is
<del class="diff-old">not
one
already).
</del>
<code>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
and
its
value
is
a
new
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>,<ins class="diff-chg">
the
second
member
is
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
and
its
value
is
a
new
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>.</li><li><ins class="diff-chg">
Reference
the
value
associated
with
the
</ins><i><ins class="diff-chg">
container
</ins></i><ins class="diff-chg">
member
in
</ins><i><ins class="diff-chg">
container
map
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
type/language
map
</ins></i>.
</li>
<li>
If
the
<del class="diff-old">compactArrays
</del>
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins>
</a>
<ins class="diff-chg">indicates
that
the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
represents
a
</ins><a href="#dfn-reverse-property" title="reverse-property" class="tref internalDFN"><ins class="diff-chg">
reverse
property
</ins></a>:<ol class="algorithm"><li><ins class="diff-chg">
Reference
the
value
associated
with
the
</ins><code><ins class="diff-chg">
@type
</ins>
</code>
<del class="diff-old">option
is
</del>
<ins class="diff-chg">member
in
</ins><i><ins class="diff-chg">
type/language
map
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
type
map
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
type
map
</ins></i><ins class="diff-chg">
does
not
have
a
</ins><code><ins class="diff-chg">
@reverse
</ins></code><ins class="diff-chg">
member,
create
one
and
</ins>
set
<ins class="diff-new">its
value
</ins>
to
<ins class="diff-new">the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
being
processed.
</ins></li></ol></li><li><ins class="diff-new">
Otherwise,
if
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-new">
term
definition
</ins></a><ins class="diff-new">
has
a
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-new">
type
mapping
</ins></a>:<ol class="algorithm"><li><ins class="diff-new">
Reference
the
value
associated
with
the
</ins>
<code>
<del class="diff-old">false
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">or
</del>
<ins class="diff-chg">member
in
</ins><i><ins class="diff-chg">
type/language
map
</ins></i><ins class="diff-chg">
using
</ins>
the
<del class="diff-old">active
property's
container
</del>
<ins class="diff-chg">variable
</ins><i><ins class="diff-chg">
type
map
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
type
map
</ins></i><ins class="diff-chg">
does
not
have
a
member
corresponding
to
the
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
</ins>
mapping
</a>
<del class="diff-old">is
</del>
<ins class="diff-chg">in
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a>,<ins class="diff-chg">
create
one
and
</ins>
set
<ins class="diff-new">its
value
</ins>
to
<ins class="diff-new">the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
being
processed.
</ins></li></ol></li><li><ins class="diff-new">
Otherwise,
if
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-new">
term
definition
</ins></a><ins class="diff-new">
has
a
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-new">
language
mapping
</ins></a><ins class="diff-new">
(might
be
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
):
</ins><ol class="algorithm"><li><ins class="diff-new">
Reference
the
value
associated
with
the
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@language
</ins>
</code>
<del class="diff-old">or
@set
,
convert
</del>
<ins class="diff-chg">member
in
</ins><i><ins class="diff-chg">
type/language
map
</ins></i><ins class="diff-chg">
using
</ins>
the
<del class="diff-old">value
of
</del>
<ins class="diff-chg">variable
</ins><i><ins class="diff-chg">
language
map
</ins></i>.</li><li><ins class="diff-chg">
If
</ins>
the
<del class="diff-old">active
property
</del>
<a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN">
<ins class="diff-chg">language
mapping
</ins>
</a>
<del class="diff-old">member
of
result
</del>
<ins class="diff-chg">equals
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
</ins><i><ins class="diff-chg">
language
</ins></i>
to
<del class="diff-old">an
array
if
</del>
<code>
<ins class="diff-chg">@null
</ins></code><ins class="diff-chg">
;
otherwise
set
</ins>
it
<del class="diff-old">is
</del>
<ins class="diff-chg">to
the
language
code
in
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
language
map
</ins></i><ins class="diff-chg">
does
</ins>
not
<ins class="diff-new">have
a
</ins><i><ins class="diff-new">
language
</ins></i><ins class="diff-new">
member,
create
</ins>
one
<del class="diff-old">already.
</del>
<ins class="diff-chg">and
set
its
value
to
the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
being
processed.
</ins>
</li>
</ol>
</li>
<del class="diff-old">If,
after
the
algorithm
outlined
above
is
run,
</del>
<li>
<ins class="diff-chg">Otherwise:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Reference
</ins>
the
<del class="diff-old">resulting
element
is
an
array
replace
it
</del>
<ins class="diff-chg">value
associated
</ins>
with
<ins class="diff-new">the
</ins><code><ins class="diff-new">
@language
</ins></code><ins class="diff-new">
member
in
</ins><i><ins class="diff-new">
type/language
map
</ins></i><ins class="diff-new">
using
the
variable
</ins><i><ins class="diff-new">
language
map
</ins></i>.</li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
language
map
</ins></i><ins class="diff-new">
does
not
have
</ins>
a
<del class="diff-old">new
JSON
object
</del>
<i>
<ins class="diff-chg">default
language
</ins></i><ins class="diff-chg">
member,
create
one
and
set
its
value
to
the
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins>
</a>
<del class="diff-old">with
</del>
<ins class="diff-chg">being
processed.
</ins></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
language
map
</ins></i><ins class="diff-chg">
does
not
have
</ins>
a
<del class="diff-old">single
member
whose
name
is
</del>
<code>
<ins class="diff-chg">@none
</ins></code><ins class="diff-chg">
member,
create
one
and
set
its
value
to
</ins>
the
<del class="diff-old">result
of
compacting
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins></a><ins class="diff-chg">
being
processed.
</ins></li><li><ins class="diff-chg">
Reference
</ins>
the
value
<ins class="diff-new">associated
with
the
</ins>
<code>
<del class="diff-old">@graph
</del>
<ins class="diff-chg">@type
</ins>
</code>
<del class="diff-old">with
</del>
<ins class="diff-chg">member
in
</ins><i><ins class="diff-chg">
type/language
map
</ins></i><ins class="diff-chg">
using
</ins>
the
<del class="diff-old">IRI
Compaction
algorithm
and
whose
value
is
element
.
Finally,
add
</del>
<ins class="diff-chg">variable
</ins><i><ins class="diff-chg">
type
map
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
type
map
</ins></i><ins class="diff-chg">
does
not
have
</ins>
a
<code>
<del class="diff-old">@context
</del>
<ins class="diff-chg">@none
</ins>
</code>
<del class="diff-old">property
to
element
</del>
<ins class="diff-chg">member,
create
one
</ins>
and
set
<del class="diff-old">it
</del>
<ins class="diff-chg">its
value
</ins>
to
the
<del class="diff-old">initially
passed
context
.
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins></a><ins class="diff-chg">
being
processed.
</ins></li></ol></li></ol></li><li><ins class="diff-chg">
Return
</ins><i><ins class="diff-chg">
result
</ins></i>.
</li>
</ol>
</section>
</section>
<section id="iri-compaction">
<h3>
<span class="secno">
<del class="diff-old">5.9
</del>
<ins class="diff-chg">8.3
</ins>
</span>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
<del class="diff-old">Algorithm
</del>
</h3>
<p>
This
<del class="diff-old">section
defines
an
</del>
algorithm
<del class="diff-old">for
transforming
</del>
<ins class="diff-chg">compacts
</ins>
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
to
a
<a href="#dfn-term" title="term" class="tref internalDFN">
term
</a>
or
<a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN">
compact
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">.
If
</del>
</a>,
<ins class="diff-chg">or
</ins>
a
<a href="#dfn-keyword" title="keyword" class="tref internalDFN">
<ins class="diff-chg">keyword
</ins></a><ins class="diff-chg">
to
a
</ins><a href="#dfn-keyword-alias" title="keyword-alias" class="tref internalDFN"><ins class="diff-chg">
keyword
alias
</ins></a>.<ins class="diff-chg">
A
</ins>
value
<ins class="diff-new">that
is
associated
with
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
may
be
passed
in
order
to
assist
in
selecting
the
most
context-appropriate
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a>.</p><section class="informative"><h4 id="general-solution-7"><ins class="diff-new">
General
Solution
</ins></h4><p><em><ins class="diff-new">
This
section
is
non-normative.
</ins>
</em>
</p>
<p>
<ins class="diff-new">If
the
passed
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>
is
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-new">null
</ins></a>,<ins class="diff-new">
we
simply
return
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>.<ins class="diff-new">
Otherwise,
we
first
try
to
find
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
that
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
or
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-new">
keyword
</ins></a><ins class="diff-new">
can
be
compacted
to
if
it
is
relative
to
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context's
</ins></a><a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN"><ins class="diff-new">
vocabulary
mapping
</ins></a>.<ins class="diff-new">
In
order
to
select
the
most
appropriate
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a>,<ins class="diff-new">
we
may
have
to
collect
information
about
the
</ins>
passed
<i>
<ins class="diff-new">value
</ins></i>.<ins class="diff-new">
This
information
includes
whic
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-new">
container
mappings
</ins></a><ins class="diff-new">
would
be
preferred
for
expressing
the
</ins><i><ins class="diff-new">
value
</ins></i>,<ins class="diff-new">
and
what
its
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-new">
type
mapping
</ins></a><ins class="diff-new">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-new">
language
mapping
</ins></a><ins class="diff-new">
is.
For
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-new">
JSON-LD
lists
</ins></a>,<ins class="diff-new">
the
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-new">
type
mapping
</ins></a><ins class="diff-new">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-new">
language
mapping
</ins></a><ins class="diff-new">
will
be
chosen
based
on
the
most
specific
values
that
work
for
all
items
in
the
list.
Once
this
information
is
gathered,
</ins>
it
is
<del class="diff-old">used
</del>
<ins class="diff-chg">passed
</ins>
to
<del class="diff-old">choose
</del>
the
<del class="diff-old">best
matching
</del>
<a href="#term-selection">
<ins class="diff-chg">Term
Selection
algorithm
</ins></a>,<ins class="diff-chg">
which
will
return
the
most
appropriate
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
to
use.
</ins></p><p><ins class="diff-chg">
If
no
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
</a>
<ins class="diff-new">was
found
that
could
be
used
to
compact
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>,<ins class="diff-new">
then
an
attempt
is
made
to
find
a
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-new">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
to
use.
If
there
is
no
appropriate
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-new">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>,<ins class="diff-new">
then,
if
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
is
relative
to
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context's
</ins></a><a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN"><ins class="diff-new">
vocabulary
mapping
</ins></a>,<ins class="diff-new">
then
it
is
used.
Otherwise,
it
is
transformed
to
a
</ins><a href="#dfn-relative-iri" title="relative-iri" class="tref internalDFN"><ins class="diff-new">
relative
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
using
the
document's
</ins><a href="#dfn-base-iri" title="base-iri" class="tref internalDFN"><ins class="diff-new">
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr>
</a>.
<ins class="diff-new">Finally,
if
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
or
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-new">
keyword
</ins></a><ins class="diff-new">
still
could
not
be
compacted,
it
is
returned
as
is.
</ins>
</p>
</section>
<section>
<h4 id="algorithm-7">
<ins class="diff-new">Algorithm
</ins></h4>
<p>
This
algorithm
takes
three
<del class="diff-old">mandatory
</del>
<ins class="diff-chg">required
inputs
</ins>
and
<del class="diff-old">two
</del>
<ins class="diff-chg">three
</ins>
optional
<del class="diff-old">parameters.
</del>
<ins class="diff-chg">inputs.
</ins>
The
<del class="diff-old">mandatory
parameters
are
the
iri
to
be
compacted,
</del>
<ins class="diff-chg">required
inputs
</ins>
an
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<del class="diff-old">and
</del>
an
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
<del class="diff-old">.
Optionally
it
is
possible
</del>
</a>,
<ins class="diff-chg">and
the
</ins><i><ins class="diff-chg">
iri
</ins></i>
to
<del class="diff-old">pass
</del>
<ins class="diff-chg">be
compacted.
The
optional
inputs
are
</ins>
a
<i>
value
<del class="diff-old">and
</del>
</i>
<ins class="diff-chg">associated
with
the
</ins><i><ins class="diff-chg">
iri
</ins></i>,
a
<del class="diff-old">vocabRelative
</del>
<i>
<ins class="diff-chg">vocab
</ins></i>
flag
which
specifies
whether
the
passed
<i>
iri
</i>
should
be
compacted
using
the
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context's
</a>
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
vocabulary
mapping
<del class="diff-old">.
If
the
vocabRelative
</del>
</a>,
<ins class="diff-chg">and
a
</ins><i><ins class="diff-chg">
reverse
</ins></i>
flag
<ins class="diff-new">which
specifies
whether
a
</ins><a href="#dfn-reverse-property" title="reverse-property" class="tref internalDFN"><ins class="diff-new">
reverse
property
</ins></a>
is
<ins class="diff-new">being
compacted.
If
</ins>
not
<ins class="diff-new">passed,
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
set
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
and
</ins><i><ins class="diff-new">
vocab
</ins></i><ins class="diff-new">
and
</ins><i><ins class="diff-new">
reverse
</ins></i><ins class="diff-new">
are
both
</ins>
set
<del class="diff-old">it
defaults
</del>
to
<code>
false
</code>.
</p>
<del class="diff-old">The
algorithm
for
generating
a
compact
IRI
is:
</del>
<ol class="algorithm">
<li>
<del class="diff-old">Initialize
a
variable
result
to
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
iri
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
return
</ins><a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>.
</li>
<li>
If
<del class="diff-old">an
entry
for
</del>
<i>
<ins class="diff-chg">vocab
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
and
</ins><i>
iri
<del class="diff-old">exists
</del>
</i>
<ins class="diff-chg">is
a
key
</ins>
in
<del class="diff-old">the
</del>
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
<del class="diff-old">,
perform
the
following
steps:
</del>
</a>:
<ol class="algorithm">
<li>
<del class="diff-old">If
a
value
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
default
language
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context's
</ins></a><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins></a>,<ins class="diff-chg">
if
it
</ins>
has
<del class="diff-old">been
passed,
perform
the
following
steps:
</del>
<ins class="diff-chg">one,
otherwise
to
</ins><code><ins class="diff-chg">
@none
</ins></code>.</li>
<li>
Initialize
<del class="diff-old">queryPath
,
which
</del>
<i>
<ins class="diff-chg">containers
</ins></i><ins class="diff-chg">
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.<ins class="diff-chg">
This
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>
will
be
used
to
<del class="diff-old">query
the
inverse
context
,
to
</del>
<ins class="diff-chg">keep
track
of
</ins>
an
<del class="diff-old">empty
array
</del>
<ins class="diff-chg">ordered
list
of
preferred
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mappings
</ins>
</a>
<ins class="diff-chg">for
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a>,<ins class="diff-chg">
based
on
what
is
compatible
with
</ins><i><ins class="diff-chg">
value
</ins></i>.
</li>
<li>
Initialize
<del class="diff-old">container
</del>
<i>
<ins class="diff-chg">type/language
</ins></i>
to
<code>
<del class="diff-old">@set
</del>
<ins class="diff-chg">@language
</ins>
</code>,
<del class="diff-old">typeOrLanguage
,
</del>
and
<del class="diff-old">typeLanguageValue
</del>
<i>
<ins class="diff-chg">type/language
value
</ins></i>
to
<del class="diff-old">null
.
</del>
<code>
<ins class="diff-chg">@null
</ins></code>.<ins class="diff-chg">
These
two
variables
will
keep
track
of
the
preferred
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
for
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a>,<ins class="diff-chg">
based
on
what
is
compatible
with
</ins><i><ins class="diff-chg">
value
</ins></i>.
</li>
<li>
If
<i>
value
</i>
is
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<del class="diff-old">and
it
has
an
</del>
<ins class="diff-chg">that
contains
the
key
</ins>
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@index
</ins></code>,<ins class="diff-chg">
then
append
the
value
</ins><code><ins class="diff-chg">
@index
</ins>
</code>
<del class="diff-old">member,
set
container
</del>
to
<del class="diff-old">@annotation
.
</del>
<i>
<ins class="diff-chg">containers
</ins></i>.
</li>
<li>
If
<del class="diff-old">value
has
an
@id
member,
</del>
<i>
<ins class="diff-chg">reverse
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a>,
set
<del class="diff-old">typeOrLanguage
</del>
<i>
<ins class="diff-chg">type/language
</ins></i>
to
<code>
@type
<del class="diff-old">and
typeLanguageValue
</del>
</code>,
<i>
<ins class="diff-chg">type/language
value
</ins></i>
to
<code>
<del class="diff-old">@id
.
</del>
<ins class="diff-chg">@reverse
</ins></code>,<ins class="diff-chg">
and
append
</ins><code><ins class="diff-chg">
@set
</ins></code><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
containers
</ins></i>.
</li>
<li>
Otherwise,
if
<i>
value
<del class="diff-old">has
an
@value
member,
</del>
</i>
<ins class="diff-chg">is
a
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-chg">
list
object
</ins></a>,<ins class="diff-chg">
then
set
</ins><i><ins class="diff-chg">
type/language
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
type/language
value
</ins></i><ins class="diff-chg">
to
the
most
specific
values
that
work
for
all
items
in
the
list
as
follows:
</ins>
<ol class="algorithm">
<li>
<del class="diff-old">and
an
</del>
<ins class="diff-chg">If
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@index
</ins>
</code>
<del class="diff-old">member,
set
typeOrLanguage
to
</del>
<ins class="diff-chg">is
a
not
key
in
</ins><i><ins class="diff-chg">
value
</ins></i>,<ins class="diff-chg">
then
append
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@list
</ins>
</code>
<del class="diff-old">and
typeLanguageValue
</del>
<ins class="diff-chg">to
</ins><i><ins class="diff-chg">
containers
</ins></i>.</li><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
list
</ins></i>
to
the
<del class="diff-old">value
of
</del>
<a href="#dfn-array" title="array" class="tref internalDFN">
<ins class="diff-chg">array
</ins></a><ins class="diff-chg">
associated
with
</ins>
the
<ins class="diff-new">key
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@list
</ins>
</code>
<del class="diff-old">member
of
</del>
<ins class="diff-chg">in
</ins><i>
value
<del class="diff-old">.
</del>
</i>.
</li>
<li>
<del class="diff-old">Otherwise,
if
it
has
an
@language
member,
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
common
language
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>.<ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
list
</ins></i><ins class="diff-chg">
is
empty,
</ins>
set
<del class="diff-old">typeOrLanguage
</del>
<i>
<ins class="diff-chg">common
language
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
default
language
</ins></i>.</li><li><ins class="diff-chg">
For
each
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
list
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
item
language
</ins></i>
to
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@none
</ins>
</code>
and
<del class="diff-old">typeLanguageValue
</del>
<i>
<ins class="diff-chg">item
type
</ins></i>
to
<code>
<ins class="diff-new">@none
</ins></code>.</li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
item
</ins></i><ins class="diff-new">
contains
</ins>
the
<del class="diff-old">value
of
the
</del>
<ins class="diff-chg">key
</ins>
<code>
<del class="diff-old">@language
member
of
value
.
</del>
<ins class="diff-chg">@value
</ins></code>:<ol class="algorithm"><li>
If
<del class="diff-old">value
has
no
</del>
<i>
<ins class="diff-chg">item
</ins></i><ins class="diff-chg">
contains
the
key
</ins>
<code>
<del class="diff-old">@annotation
member,
</del>
<ins class="diff-chg">@language
</ins></code>,<ins class="diff-chg">
then
</ins>
set
<del class="diff-old">container
</del>
<i>
<ins class="diff-chg">item
language
</ins></i>
to
<del class="diff-old">@language
</del>
<ins class="diff-chg">its
associated
value.
</ins>
</li>
<li>
Otherwise,
if
<i>
<ins class="diff-new">item
</ins></i><ins class="diff-new">
contains
</ins>
the
<del class="diff-old">value
of
value's
</del>
<ins class="diff-chg">key
</ins>
<code>
<del class="diff-old">@value
member
is
is
a
string
,
</del>
<ins class="diff-chg">@type
</ins></code>,
set
<del class="diff-old">typeOrLanguage
</del>
<i>
<ins class="diff-chg">item
type
</ins></i>
to
<del class="diff-old">@language
and
typeLanguageValue
</del>
<ins class="diff-chg">its
associated
value.
</ins></li><li><ins class="diff-chg">
Otherwise,
set
</ins><i><ins class="diff-chg">
item
language
</ins></i>
to
<code>
@null
</code>.
</li>
</ol>
</li>
<li>
Otherwise,
<del class="diff-old">if
value
has
an
</del>
<ins class="diff-chg">set
</ins><i><ins class="diff-chg">
item
type
</ins></i><ins class="diff-chg">
to
</ins>
<code>
<del class="diff-old">@list
member,
</del>
<ins class="diff-chg">@id
</ins></code>.</li>
<li>
If
<del class="diff-old">the
@list
member
has
at
least
one
item,
update
container
,
typeOrLanguage
,
and
typeLanguageValue
by
recursively
running
the
steps
2.1.2
</del>
<i>
<ins class="diff-chg">common
language
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
it
</ins>
to
<del class="diff-old">2.1.3.4
(which
will
never
be
true
since
list
of
lists
are
</del>
<i>
<ins class="diff-chg">item
language
</ins></i>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins><i><ins class="diff-chg">
item
language
</ins></i><ins class="diff-chg">
does
</ins>
not
<del class="diff-old">allowed)
of
this
algorithm
passing
the
first
</del>
<ins class="diff-chg">equal
</ins><i><ins class="diff-chg">
common
language
</ins></i><ins class="diff-chg">
and
</ins><i>
item
<del class="diff-old">of
value's
</del>
</i>
<ins class="diff-chg">contains
the
key
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@value
</ins></code>,<ins class="diff-chg">
then
set
</ins><i><ins class="diff-chg">
common
language
</ins></i><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
@none
</ins>
</code>
<del class="diff-old">member
as
new
value
.
</del>
<ins class="diff-chg">because
list
items
have
conflicting
languages.
</ins>
</li>
<li>
If
<del class="diff-old">value
has
no
@annotation
member,
</del>
<i>
<ins class="diff-chg">common
type
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,
set
<del class="diff-old">container
</del>
<ins class="diff-chg">it
</ins>
to
<del class="diff-old">@list
.
</del>
<i>
<ins class="diff-chg">item
type
</ins></i>.
</li>
<li>
<del class="diff-old">Starting
from
the
second
</del>
<ins class="diff-chg">Otherwise,
if
</ins><i>
item
<del class="diff-old">of
value's
</del>
<ins class="diff-chg">type
</ins></i><ins class="diff-chg">
does
not
equal
</ins><i><ins class="diff-chg">
common
type
</ins></i>,<ins class="diff-chg">
then
set
</ins><i><ins class="diff-chg">
common
type
</ins></i><ins class="diff-chg">
to
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@none
</ins>
</code>
<del class="diff-old">member,
recursively
run
the
steps
2.1.2
to
2.1.3.4
(which
will
never
be
true
since
</del>
<ins class="diff-chg">because
</ins>
list
<del class="diff-old">of
lists
are
not
allowed)
of
this
algorithm
passing
the
item
as
new
value
.
</del>
<ins class="diff-chg">items
have
conflicting
types.
</ins></li><li>
If
<i>
<ins class="diff-new">common
language
</ins></i><ins class="diff-new">
is
</ins><code><ins class="diff-new">
@none
</ins></code><ins class="diff-new">
and
</ins><i><ins class="diff-new">
common
type
</ins></i><ins class="diff-new">
is
</ins><code><ins class="diff-new">
@none
</ins></code>,<ins class="diff-new">
then
stop
processing
items
in
</ins>
the
<del class="diff-old">resulting
typeOrLanguage
</del>
<ins class="diff-chg">list
because
it
has
been
detected
that
there
is
no
common
language
</ins>
or
<del class="diff-old">typeLanguageValue
differ
from
</del>
<ins class="diff-chg">type
amongst
</ins>
the
<del class="diff-old">current
value
of
typeOrLanguage
or
typeLanguageValue
,
</del>
<ins class="diff-chg">items.
</ins></li></ol></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
common
language
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,
set
<del class="diff-old">both
</del>
<ins class="diff-chg">it
</ins>
to
<code>
<ins class="diff-chg">@none
</ins></code>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
common
type
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN">
null
<del class="diff-old">and
stop
processing
the
</del>
</a>,
<ins class="diff-chg">set
it
to
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@none
</ins></code>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
common
type
</ins></i><ins class="diff-chg">
is
not
</ins><code><ins class="diff-chg">
@none
</ins>
</code>
<del class="diff-old">items.
</del>
<ins class="diff-chg">then
set
</ins><i><ins class="diff-chg">
type/language
</ins></i><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
type/language
value
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
common
type
</ins></i>.
</li>
<li>
<ins class="diff-chg">Otherwise,
set
</ins><i><ins class="diff-chg">
type/language
value
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
common
language
</ins></i>.
</li>
</ol>
</li>
<li>
<ins class="diff-new">Otherwise:
</ins><ol class="algorithm"><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
a
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN"><ins class="diff-new">
value
object
</ins></a>:<ol class="algorithm"><li>
If
<i>
<ins class="diff-new">value
</ins></i><ins class="diff-new">
contains
</ins>
the
<del class="diff-old">container
equals
</del>
<ins class="diff-chg">key
</ins>
<code>
<del class="diff-old">@list
</del>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
and
does
not
contain
the
key
</ins><code><ins class="diff-chg">
@index
</ins>
</code>,
<ins class="diff-new">then
</ins>
set
<del class="diff-old">the
first
item
of
queryPath
</del>
<i>
<ins class="diff-chg">type/language
value
</ins></i>
to
<del class="diff-old">an
array
consisting
of
the
two
elements
@list
</del>
<ins class="diff-chg">its
associated
value
</ins>
and
<ins class="diff-new">append
</ins>
<code>
<del class="diff-old">null
</del>
<ins class="diff-chg">@language
</ins>
</code>
<del class="diff-old">;
otherwise
set
it
</del>
to
<del class="diff-old">an
array
consisting
of
three
elements
where
the
first
element
is
the
</del>
<i>
<ins class="diff-chg">containers
</ins></i>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins><i>
value
<del class="diff-old">of
container
and
</del>
</i>
<ins class="diff-chg">contains
</ins>
the
<del class="diff-old">other
two
elements
are
</del>
<ins class="diff-chg">key
</ins>
<code>
<del class="diff-old">@set
</del>
<ins class="diff-chg">@type
</ins></code>,<ins class="diff-chg">
then
set
</ins><i><ins class="diff-chg">
type/language
value
</ins></i><ins class="diff-chg">
to
its
associated
value
</ins>
and
<ins class="diff-new">set
</ins><i><ins class="diff-new">
type/language
</ins></i><ins class="diff-new">
to
</ins>
<code>
<del class="diff-old">@null
</del>
<ins class="diff-chg">@type
</ins>
</code>.
</li>
</ol>
</li>
<li>
<del class="diff-old">If
typeOrLanguage
is
null
,
</del>
<ins class="diff-chg">Otherwise,
</ins>
set
<del class="diff-old">the
second
</del>
<i>
<ins class="diff-chg">type/language
</ins></i><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
@type
</ins></code>
and
<del class="diff-old">the
the
third
item
of
queryPath
</del>
<ins class="diff-chg">set
</ins><i><ins class="diff-chg">
type/language
value
</ins></i>
to
<del class="diff-old">an
array
consisting
of
a
single
element
</del>
<code>
<del class="diff-old">@null
</del>
<ins class="diff-chg">@id
</ins>
</code>.
</li>
<li>
<del class="diff-old">Otherwise,
set
the
second
item
of
queryPath
</del>
<ins class="diff-chg">Append
</ins><code><ins class="diff-chg">
@set
</ins></code>
to
<del class="diff-old">an
array
consisting
</del>
<i>
<ins class="diff-chg">containers
</ins></i>.</li></ol></li><li><ins class="diff-chg">
Append
</ins><code><ins class="diff-chg">
@none
</ins></code><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
containers
</ins></i>.<ins class="diff-chg">
This
represents
the
non-existence
</ins>
of
<del class="diff-old">two
elements
where
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a>,<ins class="diff-chg">
and
it
will
be
</ins>
the
<del class="diff-old">first
element
</del>
<ins class="diff-chg">last
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
value
to
be
checked
as
it
</ins>
is
the
<ins class="diff-new">most
generic.
</ins></li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
type/language
</ins>
value
<del class="diff-old">of
typeOrLanguage
and
the
second
element
</del>
</i>
is
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-new">null
</ins></a>,<ins class="diff-new">
set
it
to
</ins>
<code>
@null
</code>.
<del class="diff-old">Set
</del>
<ins class="diff-chg">This
is
</ins>
the
<del class="diff-old">third
item
of
queryPath
</del>
<ins class="diff-chg">key
under
which
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
values
are
stored
in
the
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
context
</ins></a><i><ins class="diff-chg">
entry
</ins></i>.</li><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
preferred
values
</ins></i>
to
an
<ins class="diff-chg">empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.<ins class="diff-chg">
This
</ins><a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>
<del class="diff-old">whose
first
element
typeLanguageValue
and
whose
second
element
</del>
<ins class="diff-chg">will
indicate,
in
order,
the
preferred
values
for
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term's
</ins></a><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
type/language
value
</ins></i>
is
<code>
<del class="diff-old">@null
.
</del>
<ins class="diff-chg">@reverse
</ins></code>,<ins class="diff-chg">
append
</ins><code><ins class="diff-chg">
@reverse
</ins></code><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
preferred
values
</ins></i>.
</li>
<li>
<del class="diff-old">Query
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
type/language
value
</ins></i><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@reverse
</ins></code><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
the
result
of
using
</ins>
the
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-new">IRI
</ins></abbr><ins class="diff-new">
compaction
algorithm
</ins></a>,<ins class="diff-new">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
<del class="diff-old">and
store
</del>
</a>,
the
<del class="diff-old">result
</del>
<ins class="diff-chg">value
associated
with
the
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
key
</ins>
in
<del class="diff-old">result
.
If
result
is
a
a
string
</del>
<i>
<ins class="diff-chg">value
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
iri
</ins></i>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins>
</a>
<del class="diff-old">or
</del>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
vocab
</ins></i>,<ins class="diff-chg">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
document
relative
</ins></i><ins class="diff-chg">
has
</ins>
a
<del class="diff-old">JSON
object
</del>
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins></a><ins class="diff-chg">
in
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins>
</a>
with
<del class="diff-old">a
</del>
<ins class="diff-chg">an
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
that
equals
the
value
associated
with
the
</ins>
<code>
<del class="diff-old">term
</del>
<ins class="diff-chg">@id
</ins>
</code>
<del class="diff-old">member,
return
result
.
</del>
<ins class="diff-chg">key
in
</ins><i><ins class="diff-chg">
value
</ins></i>,<ins class="diff-chg">
then
append
</ins><code><ins class="diff-chg">
@vocab
</ins></code>,<code><ins class="diff-chg">
@id
</ins></code>,<ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
@none
</ins></code>,<ins class="diff-chg">
in
that
order,
to
</ins><i><ins class="diff-chg">
preferred
values
</ins></i>.</li><li><ins class="diff-chg">
Otherwise,
append
</ins><code><ins class="diff-chg">
@id
</ins></code>,<code><ins class="diff-chg">
@vocab
</ins></code>,<ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
@none
</ins></code>,<ins class="diff-chg">
in
that
order,
to
</ins><i><ins class="diff-chg">
preferred
values
</ins></i>.
</li>
</ol>
</li>
<li>
Otherwise,
<del class="diff-old">if
the
entry
for
iri
</del>
<ins class="diff-chg">append
</ins><i><ins class="diff-chg">
type/language
value
</ins></i><ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
@none
</ins></code>,
in
<ins class="diff-new">that
order,
to
</ins><i><ins class="diff-new">
preferred
values
</ins></i>.</li><li><ins class="diff-new">
Initialize
</ins><i><ins class="diff-new">
term
</ins></i><ins class="diff-new">
to
</ins>
the
<ins class="diff-chg">result
of
the
</ins><a href="#term-selection"><ins class="diff-chg">
Term
Selection
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
<del class="diff-old">has
a
</del>
</a>,
<i>
<ins class="diff-chg">iri
</ins></i>,<i><ins class="diff-chg">
containers
</ins></i>,<i><ins class="diff-chg">
type/language
</ins></i>,<ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
preferred
values
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i>
term
<del class="diff-old">member,
</del>
</i>
<ins class="diff-chg">is
not
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,
return
<del class="diff-old">its
value.
</del>
<i>
<ins class="diff-chg">term
</ins></i>.
</li>
</ol>
</li>
<li>
<ins class="diff-new">At
this
point,
there
is
no
simple
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
that
</ins><i><ins class="diff-new">
iri
</ins></i><ins class="diff-new">
can
be
compacted
to.
Instead,
try
to
create
a
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-new">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>,<ins class="diff-new">
starting
by
initializing
</ins><i><ins class="diff-new">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></i><ins class="diff-new">
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>.<ins class="diff-new">
This
variable
will
be
used
to
store
the
created
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-new">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a>,<ins class="diff-new">
if
any.
</ins></li><li>
For
each
<del class="diff-old">termIri
-
termDefinition
pair
in
inverse
context
</del>
<ins class="diff-chg">key
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
and
value
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins>
</a>
<del class="diff-old">sorted
</del>
in
<del class="diff-old">reverse
order
by
termIri
the
(longest
termIri
comes
first),
perform
</del>
the
<del class="diff-old">following
steps:
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-chg">active
context
</ins></a>:
<ol class="algorithm">
<li>
If
<del class="diff-old">termDefinition
does
not
have
a
</del>
<ins class="diff-chg">the
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
<del class="diff-old">member,
i.e.,
it
is
</del>
</a>
<ins class="diff-chg">contains
</ins>
a
<del class="diff-old">property
generator,
</del>
<ins class="diff-chg">colon
(
</ins><code>:</code><ins class="diff-chg">
),
then
</ins>
continue
<del class="diff-old">with
</del>
<ins class="diff-chg">to
</ins>
the
next
<del class="diff-old">termIri
-
termDefinition
pair
from
inverse
context
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins></a><ins class="diff-chg">
because
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
with
colons
can't
be
used
as
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefixes
</ins>
</a>.
</li>
<li>
<del class="diff-old">Otherwise,
if
iri
begins
with
termIri
and
</del>
<ins class="diff-chg">If
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a>
is
<del class="diff-old">longer
than
termIri
,
generate
a
compact
</del>
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-chg">null
</ins></a>,<ins class="diff-chg">
its
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<ins class="diff-new">mapping
</ins></a><ins class="diff-new">
equals
</ins><i><ins class="diff-new">
iri
</ins></i>,<ins class="diff-new">
or
its
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-new">IRI
</ins></abbr><ins class="diff-new">
mapping
</ins>
</a>
<del class="diff-old">by
concatenating
</del>
<ins class="diff-chg">is
not
a
substring
at
</ins>
the
<del class="diff-old">value
</del>
<ins class="diff-chg">beginning
</ins>
of
<i>
<ins class="diff-new">iri
</ins></i>,
the
<a href="#dfn-term" title="term" class="tref internalDFN">
term
<del class="diff-old">member
of
termDefinition
</del>
</a>
<ins class="diff-chg">cannot
be
used
as
a
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefix
</ins></a><ins class="diff-chg">
because
it
is
not
a
partial
match
</ins>
with
<i>
<ins class="diff-new">iri
</ins></i>.<ins class="diff-new">
Continue
with
the
next
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a>.</li><li><ins class="diff-new">
Initialize
</ins><i><ins class="diff-new">
candidate
</ins></i><ins class="diff-new">
by
concatenating
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a>,
a
colon
(
<code>:
</code>
<del class="diff-old">)
character
</del>
<ins class="diff-chg">),
</ins>
and
the
<del class="diff-old">unmatched
part
</del>
<ins class="diff-chg">substring
</ins>
of
<i>
iri
<del class="diff-old">.
</del>
</i>
<ins class="diff-chg">that
follows
after
the
value
of
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition's
</ins></a><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a>.
</li>
<li>
If
<ins class="diff-new">either
</ins><i><ins class="diff-new">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></i><ins class="diff-new">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
or
</ins><i><ins class="diff-new">
candidate
</ins></i><ins class="diff-new">
is
shorter
or
</ins>
the
<del class="diff-old">resulting
</del>
<ins class="diff-chg">same
length
but
lexicographically
less
than
</ins><i>
compact
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</i>
<ins class="diff-new">and
</ins><i><ins class="diff-new">
candidate
</ins></i><ins class="diff-new">
does
not
have
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-new">
term
definition
</ins>
</a>
<del class="diff-old">has
an
entry
</del>
in
<del class="diff-old">the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
<del class="diff-old">,
continue
with
the
next
termIri
-
termDefinition
pair
from
inverse
context
</del>
</a>
<del class="diff-old">as
</del>
<ins class="diff-chg">or
if
</ins>
the
<a href="#dfn-term-definition" title="term-definition" class="tref internalDFN">
<ins class="diff-chg">term
definition
</ins></a><ins class="diff-chg">
has
an
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a><ins class="diff-chg">
that
equals
</ins><i><ins class="diff-chg">
iri
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
</ins><i>
compact
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">cannot
be
used.
</del>
</i>
<ins class="diff-chg">to
</ins><i><ins class="diff-chg">
candidate
</ins></i>.</li></ol>
</li>
<li>
<del class="diff-old">Otherwise,
if
result
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
compact
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></i>
is
<ins class="diff-chg">not
</ins><a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>,
return
<del class="diff-old">the
</del>
<i>
compact
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">;
if
it
</del>
</i>.
</li>
<li>
<ins class="diff-chg">At
this
point,
there
</ins>
is
<del class="diff-old">not
null,
set
the
term
member
of
result
to
the
</del>
<ins class="diff-chg">no
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN">
compact
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
<del class="diff-old">and
return
result
.
If
the
vocabRelative
flag
</del>
<ins class="diff-chg">that
</ins><i><ins class="diff-chg">
iri
</ins></i><ins class="diff-chg">
can
be
compacted
to,
so
if
</ins><i><ins class="diff-chg">
vocab
</ins></i>
is
<del class="diff-old">set
to
</del>
<a href="#dfn-true" title="true" class="tref internalDFN">
true
<del class="diff-old">,
the
</del>
</a>
<ins class="diff-chg">and
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>
has
a
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
vocabulary
mapping
<del class="diff-old">,
and
</del>
</a>:
<ol class="algorithm">
<li>
<ins class="diff-chg">If
</ins><i>
iri
</i>
begins
with
the
<del class="diff-old">IRI
of
the
</del>
<a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN">
vocabulary
<del class="diff-old">mapping
</del>
<ins class="diff-chg">mapping's
</ins>
</a>
<ins class="diff-new">value
</ins>
but
is
<del class="diff-old">longer
Set
vocabIri
</del>
<ins class="diff-chg">longer,
then
initialize
</ins><i><ins class="diff-chg">
suffix
</ins></i>
to
the
<del class="diff-old">unmatched
part
</del>
<ins class="diff-chg">substring
</ins>
of
<i>
iri
<del class="diff-old">.
</del>
</i>
<ins class="diff-chg">that
does
not
match.
</ins>
If
<del class="diff-old">there
</del>
<i>
<ins class="diff-chg">suffix
</ins></i>
does
not
<del class="diff-old">exist
an
entry
for
vocabIri
</del>
<ins class="diff-chg">have
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a>
in
<del class="diff-old">the
</del>
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<ins class="diff-new">then
</ins>
return
<del class="diff-old">vocabIri
if
result
is
null
;
if
it
is
not
null
set
the
term
member
of
result
to
vocabIri
and
return
result
.
</del>
<i>
<ins class="diff-chg">suffix
</ins></i>.
</li>
</ol>
</li>
<li>
If
<del class="diff-old">result
</del>
<i>
<ins class="diff-chg">vocab
</ins></i>
is
<del class="diff-old">null
,
return
</del>
<a href="#dfn-false" title="false" class="tref internalDFN">
<ins class="diff-chg">false
</ins></a><ins class="diff-chg">
then
transform
</ins><i>
iri
<del class="diff-old">as
is.
</del>
</i>
<ins class="diff-chg">to
a
</ins><a href="#dfn-relative-iri" title="relative-iri" class="tref internalDFN"><ins class="diff-chg">
relative
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
using
the
document's
base
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.
</li>
<li>
<del class="diff-old">Otherwise
set
the
term
member
of
result
to
iri
and
</del>
<ins class="diff-chg">Finally,
</ins>
return
<del class="diff-old">result
.
</del>
<i>
<ins class="diff-chg">iri
</ins></i><ins class="diff-chg">
as
is.
</ins>
</li>
</ol>
</section>
</section>
<section id="term-selection">
<h3>
<span class="secno">
<del class="diff-old">5.10
</del>
<ins class="diff-chg">8.4
</ins>
</span>
<del class="diff-old">Inverse
Context
Creation
</del>
<ins class="diff-chg">Term
Selection
</ins>
</h3>
<p>
<del class="diff-old">An
active
context
as
produced
by
the
Context
Processing
algorithm
is
very
efficient
for
expanding
terms
and
compact
IRIs
to
IRIs
but
is
of
limited
use
for
</del>
<ins class="diff-chg">This
algorithm,
invoked
via
</ins>
the
<del class="diff-old">opposite
operation:
</del>
<a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">compaction
.
Hence,
this
</del>
<ins class="diff-chg">Compaction
</ins>
algorithm
<del class="diff-old">introduces
the
notion
</del>
</a>,
<ins class="diff-chg">makes
use
</ins>
of
an
<a href="#dfn-active-context" title="active-context" class="tref internalDFN">
<ins class="diff-chg">active
context's
</ins></a><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
</a>
<del class="diff-old">which
brings
</del>
<ins class="diff-chg">to
find
</ins>
the
<del class="diff-old">same
efficiency
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins></a><ins class="diff-chg">
that
is
best
used
</ins>
to
<a href="#dfn-compaction" title="compaction" class="tref internalDFN">
<ins class="diff-chg">compact
</ins></a><ins class="diff-chg">
an
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">compaction
</del>
</a>.
<del class="diff-old">An
inverse
context
a
tree
of
JSON
objects
which
allow
to
efficiently
select
a
term
for
</del>
<ins class="diff-chg">Other
information
about
</ins>
a
<ins class="diff-chg">value
associated
with
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
<del class="diff-old">-value
pair.
The
value
takes
an
active
context
</del>
<ins class="diff-chg">is
given,
including
which
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mappings
</ins>
</a>
and
<del class="diff-old">returns
</del>
<ins class="diff-chg">which
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
would
be
best
used
to
express
</ins>
the
<del class="diff-old">corresponding
inverse
context
.
</del>
<ins class="diff-chg">value.
</ins>
</p>
<del class="diff-old">Set
</del>
<section class="informative">
<h4 id="general-solution-8">
<ins class="diff-chg">General
Solution
</ins></h4><p>
<em>
<del class="diff-old">defaultLanguage
</del>
<ins class="diff-chg">This
section
is
non-normative.
</ins>
</em>
<del class="diff-old">to
active
</del>
</p>
<p>
<ins class="diff-chg">The
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-chg">
inverse
</ins>
context's
</a>
<del class="diff-old">default
language
if
there
is
one;
otherwise
set
it
to
@null
.
For
each
term
definition
in
the
active
context
perform
the
following
steps:
If
</del>
<ins class="diff-chg">entry
for
</ins>
the
<del class="diff-old">term's
</del>
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">mapping
</del>
</a>
<del class="diff-old">is
set
</del>
<ins class="diff-chg">will
be
first
searched
according
</ins>
to
<del class="diff-old">null
continue
with
</del>
the
<del class="diff-old">next
term
definition
.
Set
</del>
<ins class="diff-chg">preferred
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
container
<del class="diff-old">to
the
value
of
</del>
<ins class="diff-chg">mappings
</ins></a>,<ins class="diff-chg">
in
</ins>
the
<del class="diff-old">term's
</del>
<ins class="diff-chg">order
that
they
are
given.
Amongst
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
terms
</ins>
</a>
<ins class="diff-chg">with
a
matching
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
container
mapping
</a>,
<ins class="diff-new">preference
will
be
given
to
those
with
a
matching
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-new">
type
mapping
</ins>
</a>
or
<del class="diff-old">@null
if
no
such
</del>
<a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN">
<ins class="diff-chg">language
</ins>
mapping
<del class="diff-old">exists.
</del>
</a>,
<ins class="diff-chg">over
those
without
a
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a>.
If
<del class="diff-old">the
</del>
<ins class="diff-chg">there
is
no
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
</a>
<del class="diff-old">is
</del>
<ins class="diff-chg">with
</ins>
a
<del class="diff-old">property
generator
,
set
termType
to
propertyGenerators
.
Otherwise
set
set
termType
to
term
and
append
the
term
</del>
<ins class="diff-chg">matching
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins>
</a>
<del class="diff-old">to
</del>
<ins class="diff-chg">then
</ins>
the
<a href="#dfn-term" title="term" class="tref internalDFN">
term
<del class="diff-old">member
of
the
JSON
object
</del>
</a>
<del class="diff-old">for
</del>
<ins class="diff-chg">without
a
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
that
matches
</ins>
the
<del class="diff-old">term's
</del>
<ins class="diff-chg">given
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins>
</a>
<del class="diff-old">IRI
in
inverse
context
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins>
</a>
<del class="diff-old">(append
term
to
inverseContext[iri]['term']
).
For
each
iri
mapped
to
the
</del>
<ins class="diff-chg">is
selected.
If
there
is
still
no
selected
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
</a>,
<del class="diff-old">perform
the
following
steps:
If
the
</del>
<ins class="diff-chg">then
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
</a>
<del class="diff-old">has
a
</del>
<ins class="diff-chg">with
no
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
type
mapping
</a>
<del class="diff-old">to
type
,
append
the
term
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins>
</a>
<del class="diff-old">to
inverseContext[iri][container]['@type'][type][termType]
,
e.g.,
inverseContext['http://...']['@list']['@type']['http://...']['term']
.
Otherwise,
</del>
<ins class="diff-chg">will
be
selected
</ins>
if
<del class="diff-old">the
</del>
<ins class="diff-chg">available.
No
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
</a>
<ins class="diff-new">will
be
selected
that
</ins>
has
a
<del class="diff-old">language
</del>
<ins class="diff-chg">conflicting
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
</ins>
mapping
</a>
<del class="diff-old">store
the
associated
language
in
language
,
replacing
null
with
@null
.
Then
append
the
term
to
inverseContext[iri][container]['@language'][language][termType]
,
e.g.,
inverseContext['http://...']['@list']['@language']['de']['term']
.
Otherwise
append
the
term
to
inverseContext[iri][container]['@null']['@null'][termType]
as
well
as
inverseContext[iri][container]['@language'][defaultLanguage][termType]
to
take
the
default
language
into
consideration
for
terms
without
explicit
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN">
language
mapping
</a>.
<del class="diff-old">Remove
all
but
</del>
<ins class="diff-chg">Ties
between
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
terms
</ins></a><ins class="diff-chg">
that
have
the
same
mappings
are
resolved
by
first
choosing
</ins>
the
shortest
<ins class="diff-new">terms,
</ins>
and
<del class="diff-old">lexicographically
least
term
in
each
term
member
in
inverse
context
.
The
result
is
thus
a
single
string
value.
Finally,
sort
</del>
<ins class="diff-chg">then
by
choosing
</ins>
the
<del class="diff-old">array
associated
with
every
propertyGenerators
member
in
inverse
context
</del>
lexicographically
<del class="diff-old">(shortest
terms
come
first).
5.11
Inverse
Context
Query
Algorithm
It
is
possible
that
multiple
terms
</del>
<ins class="diff-chg">least
term.
Note
</ins>
that
<del class="diff-old">differ
in
their
container
,
type
,
or
language
mapping
</del>
<ins class="diff-chg">these
ties
</ins>
are
<del class="diff-old">mapped
to
</del>
<ins class="diff-chg">resolved
automatically
because
they
were
previously
resolved
when
</ins>
the
<del class="diff-old">same
IRI
.
The
purpose
of
this
</del>
<a href="#inverse-context-creation">
<ins class="diff-chg">Inverse
Context
Creation
</ins>
algorithm
<del class="diff-old">is
</del>
</a>
<ins class="diff-chg">was
used
</ins>
to
<del class="diff-old">query
</del>
<ins class="diff-chg">create
</ins>
the
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
<del class="diff-old">to
return
either
the
best
matching
term
,
or
a
list
of
potential
property
generators
along
with
a
term
to
fall
back
to
if
none
of
the
property
generators
can
be
applied.
</del>
</a>.
</p>
</section>
<section>
<h4 id="algorithm-8">
<ins class="diff-new">Algorithm
</ins></h4>
<p>
This
algorithm
<del class="diff-old">takes
</del>
<ins class="diff-chg">has
five
required
inputs.
They
are:
</ins>
an
<del class="diff-old">inverseContextSubtree
,
</del>
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
<ins class="diff-chg">inverse
context
</ins></a>,
a
<del class="diff-old">queryPath
as
generated
by
the
</del>
<a href="#dfn-keyword" title="keyword" class="tref internalDFN">
<ins class="diff-chg">keyword
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">Compaction
algorithm
</del>
</a>
<del class="diff-old">and
a
level
parameter
which
is
initialized
to
0
if
nothing
else
is
passed.
The
algorithm
returns
either
</del>
<i>
<ins class="diff-chg">iri
</ins></i>,<ins class="diff-chg">
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><i><ins class="diff-chg">
containers
</ins></i><ins class="diff-chg">
that
represents
an
ordered
list
of
preferred
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mappings
</ins></a>,
a
<a href="#dfn-string" title="string" class="tref internalDFN">
string
</a>
<del class="diff-old">representing
the
best
matching
term
or
</del>
<i>
<ins class="diff-chg">type/language
</ins></i><ins class="diff-chg">
that
indicates
whether
to
look
for
</ins>
a
<del class="diff-old">JSON
object
</del>
<a href="#dfn-term" title="term" class="tref internalDFN">
<ins class="diff-chg">term
</ins>
</a>
<del class="diff-old">consisting
of
a
propertyGenerators
member,
containing
</del>
<ins class="diff-chg">with
</ins>
a
<del class="diff-old">sorted
array
</del>
<ins class="diff-chg">matching
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins>
</a>
<del class="diff-old">of
potential
property
generators
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins>
</a>,
and
an
<del class="diff-old">optional
term
member
containing
a
term
</del>
<a href="#dfn-array" title="array" class="tref internalDFN">
<ins class="diff-chg">array
</ins>
</a>
<del class="diff-old">to
fall
back
to
if
none
</del>
<ins class="diff-chg">representing
an
ordered
list
</ins>
of
<i>
<ins class="diff-new">preferred
values
</ins></i><ins class="diff-new">
for
</ins>
the
<del class="diff-old">property
generators
</del>
<a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
<ins class="diff-chg">type
mapping
</ins>
</a>
<del class="diff-old">can
be
applied.
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
to
look
for.
</ins>
</p>
<ol class="algorithm">
<li>
Initialize
<del class="diff-old">result
</del>
<i>
<ins class="diff-chg">container
map
</ins></i>
to
<del class="diff-old">null
.
If
level
equals
3
,
i.e.,
</del>
the
<del class="diff-old">deepest
nested
JSON
object
</del>
<ins class="diff-chg">value
associated
with
</ins><i><ins class="diff-chg">
iri
</ins></i>
in
the
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
inverse
context
<del class="diff-old">has
been
reached,
perform
the
following
steps:
</del>
</a>.
</li>
<li>
<del class="diff-old">If
inverseContextSubtree
has
a
propertyGenerators
member,
copy
that
member
into
a
new
JSON
object
and
store
that
object
</del>
<ins class="diff-chg">For
each
item
</ins><i><ins class="diff-chg">
container
</ins></i>
in
<del class="diff-old">result
.
</del>
<i>
<ins class="diff-chg">containers
</ins></i>:<ol class="algorithm">
<li>
If
<del class="diff-old">inverseContextSubtree
has
a
term
member
and
result
</del>
<i>
<ins class="diff-chg">container
</ins></i>
is
<del class="diff-old">null
,
return
the
value
of
that
member;
otherwise
result
</del>
<ins class="diff-chg">not
a
key
in
</ins><i><ins class="diff-chg">
container
map
</ins></i>,<ins class="diff-chg">
then
there
</ins>
is
<ins class="diff-new">no
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-new">
term
</ins></a><ins class="diff-new">
with
</ins>
a
<del class="diff-old">JSON
object
,
copy
</del>
<ins class="diff-chg">matching
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins></a><ins class="diff-chg">
for
it,
so
continue
to
</ins>
the
<del class="diff-old">term
member
into
result
and
return
result
.
</del>
<ins class="diff-chg">next
</ins><i><ins class="diff-chg">
container
</ins></i>.
</li>
<li>
<del class="diff-old">Otherwise,
for
each
entry
of
the
array
in
queryPath's
level'd
position
(
queryPath[level]
),
perform
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
type/language
map
</ins></i><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">following
steps:
If
inverseContextSubtree
has
no
entry
member,
continue
</del>
<ins class="diff-chg">value
associated
</ins>
with
the
<del class="diff-old">next
entry
.
</del>
<i>
<ins class="diff-chg">container
</ins></i><ins class="diff-chg">
member
in
</ins><i><ins class="diff-chg">
container
map
</ins></i>.
</li>
<li>
<del class="diff-old">Otherwise
set
tmpResult
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
value
map
</ins></i>
to
the
<del class="diff-old">result
of
recursively
invoking
this
algorithm
passing
the
entry
</del>
<ins class="diff-chg">value
associated
with
</ins><i><ins class="diff-chg">
type/language
</ins></i>
member
<del class="diff-old">of
inverseContextSubtree
as
new
inverseContextSubtree
,
queryPath
,
and
level
+
1
as
new
level
.
</del>
<ins class="diff-chg">in
</ins><i><ins class="diff-chg">
type/language
map
</ins></i>.
</li>
<li>
<ins class="diff-new">For
each
</ins><i><ins class="diff-new">
item
</ins></i><ins class="diff-new">
in
</ins><i><ins class="diff-new">
preferred
values
</ins></i>:<ol class="algorithm"><li>
If
<del class="diff-old">tmpResult
is
a
string
and
result
is
null
,
return
tmpResult
;
otherwise,
if
result
</del>
<i>
<ins class="diff-chg">item
</ins></i>
is
not
<del class="diff-old">null
,
transform
tmpResult
to
</del>
a
<del class="diff-old">JSON
object
whose
propertyGenerators
member
</del>
<ins class="diff-chg">key
in
</ins><i><ins class="diff-chg">
value
map
</ins></i>,<ins class="diff-chg">
then
there
</ins>
is
<del class="diff-old">set
to
an
empty
array
and
whose
</del>
<ins class="diff-chg">no
</ins><a href="#dfn-term" title="term" class="tref internalDFN">
term
<del class="diff-old">member
is
set
to
tmpResult
.
If
result
is
null
,
replace
it
</del>
</a>
with
<del class="diff-old">tmpResult
.
</del>
<ins class="diff-chg">a
matching
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a>,<ins class="diff-chg">
so
continue
to
the
next
</ins><i><ins class="diff-chg">
item
</ins></i>.
</li>
<li>
Otherwise,
<del class="diff-old">append
each
item
of
</del>
<ins class="diff-chg">a
matching
term
has
been
found,
return
</ins>
the
<del class="diff-old">propertyGenerator
member
of
tmpResult
to
</del>
<ins class="diff-chg">value
associated
with
</ins>
the
<del class="diff-old">propertyGenerator
</del>
<i>
<ins class="diff-chg">item
</ins></i>
member
<del class="diff-old">of
result
unless
it
is
already
</del>
in
<del class="diff-old">result's
member.
If
result
has
no
term
member
but
tmpResult
does,
copy
tmpResult's
term
member
into
result
.
</del>
<i>
<ins class="diff-chg">value
map
</ins></i>.</li></ol>
</li>
</ol>
</li>
<li>
<ins class="diff-new">No
matching
term
has
been
found.
</ins>
Return
<del class="diff-old">result
.
</del>
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-chg">null
</ins></a>.
</li>
</ol>
</section>
</section>
<section id="value-compaction">
<h3>
<span class="secno">
<del class="diff-old">5.12
</del>
<ins class="diff-chg">8.5
</ins>
</span>
Value
Compaction
</h3>
<p>
<a href="#dfn-expansion" title="expansion" class="tref internalDFN">
Expansion
</a>
transforms
all
values
into
<a href="#dfn-expanded-form" title="expanded-form" class="tref internalDFN">
expanded
form
</a>
in
JSON-LD.
This
algorithm
<del class="diff-old">does
the
opposite,
it
compacts
an
algorithm
according
the
term
definition
of
the
passed
active
property
.
After
</del>
<ins class="diff-chg">performs
</ins>
the
<del class="diff-old">application
of
this
algorithm
</del>
<ins class="diff-chg">opposite
operation,
transforming
</ins>
a
value
<del class="diff-old">is
said
to
be
in
</del>
<ins class="diff-chg">into
</ins><dfn id="dfn-compacted-form" title="compacted-form">
compacted
form
</dfn>.
This
algorithm
<del class="diff-old">takes
</del>
<ins class="diff-chg">compacts
</ins>
a
value
<del class="diff-old">,
an
</del>
<ins class="diff-chg">according
to
the
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
in
the
given
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
<del class="diff-old">,
an
inverse
context
,
an
</del>
</a>
<ins class="diff-chg">that
is
associated
with
the
value's
associated
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
<del class="diff-old">,
and
an
optional
containerValue
.
</del>
</a>.
</p>
<del class="diff-old">If
a
</del>
<section class="informative">
<h4 id="general-solution-9">
<ins class="diff-chg">General
Solution
</ins></h4><p>
<em>
<del class="diff-old">containerValue
</del>
<ins class="diff-chg">This
section
is
non-normative.
</ins>
</em>
</p>
<p>
<ins class="diff-new">The
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
to
compact
</ins>
has
<del class="diff-old">been
passed,
</del>
<ins class="diff-chg">either
an
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
or
an
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member.
</ins></p><p><ins class="diff-chg">
For
</ins>
the
<ins class="diff-chg">former
case,
if
the
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins></a><ins class="diff-chg">
of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
<del class="diff-old">has
a
container
mapping
</del>
<ins class="diff-chg">is
</ins>
set
to
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@id
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@vocab
</ins>
</code>
and
<i>
value
<del class="diff-old">has
</del>
</i>
<ins class="diff-chg">consists
of
only
of
</ins>
an
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@id
</ins>
</code>
member
<del class="diff-old">which
equals
containerValue
,
remove
that
member.
If
value
is
a
JSON
object
</del>
<ins class="diff-chg">and,
if
if
the
</ins><a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN"><ins class="diff-chg">
container
mapping
</ins>
</a>
<del class="diff-old">having
a
single
member
</del>
<ins class="diff-chg">of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
is
set
to
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">@index
</ins>
</code>,
<del class="diff-old">return
</del>
<ins class="diff-chg">an
</ins><code><ins class="diff-chg">
@index
</ins></code><ins class="diff-chg">
member,
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
can
be
compacted
to
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
by
returning
</ins>
the
result
of
<del class="diff-old">performing
</del>
<ins class="diff-chg">using
the
</ins><a href="#iri-compaction">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
Compaction
<ins class="diff-new">algorithm
</ins>
</a>
<del class="diff-old">on
that
member's
value.
</del>
<ins class="diff-chg">to
compact
the
value
associated
with
the
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member.
</ins>
Otherwise,
<del class="diff-old">if
</del>
<i>
value
</i>
<ins class="diff-chg">cannot
be
compacted
and
</ins>
is
<del class="diff-old">a
JSON
object
having
a
</del>
<ins class="diff-chg">returned
as
is.
</ins></p><p><ins class="diff-chg">
For
the
latter
case,
it
might
be
possible
to
compact
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
just
into
the
value
associated
with
the
</ins>
<code>
@value
</code>
<del class="diff-old">member,
perform
the
following
steps:
If
</del>
<ins class="diff-chg">member.
This
can
be
done
if
</ins>
the
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
has
a
<ins class="diff-chg">matching
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
type
mapping
</a>
<ins class="diff-new">or
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-new">
language
mapping
</ins></a>
and
<del class="diff-old">value
has
a
corresponding
</del>
<ins class="diff-chg">there
is
either
no
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@index
</ins>
</code>
<del class="diff-old">member,
remove
</del>
<ins class="diff-chg">member
or
</ins>
the
<a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
<ins class="diff-new">container
mapping
</ins></a><ins class="diff-new">
of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
is
set
to
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@index
</ins></code>.<ins class="diff-chg">
It
can
also
be
done
if
</ins><code><ins class="diff-chg">
@value
</ins>
</code>
<ins class="diff-new">is
the
only
</ins>
member
<del class="diff-old">from
</del>
<ins class="diff-chg">in
</ins><i>
value
<del class="diff-old">.
Otherwise,
if
</del>
</i>
<ins class="diff-chg">(apart
an
</ins><code><ins class="diff-chg">
@index
</ins></code><ins class="diff-chg">
member
in
case
</ins>
the
<a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
<ins class="diff-chg">container
mapping
</ins></a><ins class="diff-chg">
of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
<del class="diff-old">has
</del>
<ins class="diff-chg">is
set
to
</ins><code><ins class="diff-chg">
@index
</ins></code><ins class="diff-chg">
)
and
either
its
associated
value
is
not
</ins>
a
<a href="#dfn-string" title="string" class="tref internalDFN">
<ins class="diff-chg">string
</ins></a>,<ins class="diff-chg">
there
is
no
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins></a>,<ins class="diff-chg">
or
there
is
an
explicit
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN">
language
mapping
</a>
<ins class="diff-new">for
the
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>.</p></section><section><h4 id="algorithm-9"><ins class="diff-new">
Algorithm
</ins></h4><p><ins class="diff-new">
This
algorithm
has
four
required
inputs:
an
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<ins class="diff-new">
an
</ins><a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-new">
inverse
context
</ins></a>,<ins class="diff-new">
an
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>,
and
<ins class="diff-chg">a
</ins><i>
value
</i>
<ins class="diff-chg">to
be
compacted.
</ins></p><ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
number
members
</ins></i><ins class="diff-chg">
to
the
number
of
members
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
contains.
</ins></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
value
</ins></i>
has
<del class="diff-old">a
corresponding
</del>
<ins class="diff-chg">an
</ins>
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@index
</ins>
</code>
<del class="diff-old">member,
remove
</del>
<ins class="diff-chg">member
and
</ins>
the
<a href="#dfn-container-mapping" title="container-mapping" class="tref internalDFN">
<ins class="diff-new">container
mapping
</ins></a><ins class="diff-new">
associated
to
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
is
set
to
</ins>
<code>
<del class="diff-old">@language
member
from
</del>
<ins class="diff-chg">@index
</ins></code>,<ins class="diff-chg">
decrease
</ins><i><ins class="diff-chg">
number
members
</ins></i><ins class="diff-chg">
by
</ins><code><ins class="diff-chg">
1
</ins></code>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
number
members
</ins></i><ins class="diff-chg">
is
greater
than
</ins><code><ins class="diff-chg">
2
</ins></code>,<ins class="diff-chg">
return
</ins><i>
value
<del class="diff-old">.
</del>
</i>
<ins class="diff-chg">as
it
cannot
be
compacted.
</ins>
</li>
<li>
<del class="diff-old">Otherwise,
if
a
containerValue
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
value
</ins></i>
has
<del class="diff-old">been
passed,
</del>
<ins class="diff-chg">an
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
number
members
</ins></i><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
1
</ins></code><ins class="diff-chg">
and
</ins>
the
<a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
<ins class="diff-chg">type
mapping
</ins></a><ins class="diff-chg">
of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
<del class="diff-old">has
a
container
mapping
</del>
<ins class="diff-chg">is
</ins>
set
to
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@id
</ins>
</code>,
<ins class="diff-new">return
the
result
of
using
the
</ins><a href="#iri-compaction"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
compaction
algorithm
</ins></a>,<ins class="diff-new">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a>,<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN"><ins class="diff-new">
inverse
context
</ins></a>,
and
<ins class="diff-chg">the
</ins>
value
<del class="diff-old">has
a
@language
member
which
equals
containerValue
,
remove
</del>
<ins class="diff-chg">of
</ins>
the
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@id
</ins>
</code>
member
<del class="diff-old">from
value
.
</del>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
iri
</ins></i>.
</li>
<li>
Otherwise,
if
<i>
<ins class="diff-new">number
members
</ins></i><ins class="diff-new">
is
</ins><code><ins class="diff-new">
1
</ins></code><ins class="diff-new">
and
</ins>
the
<a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN">
<ins class="diff-chg">type
mapping
</ins></a><ins class="diff-chg">
of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a><ins class="diff-chg">
is
set
to
</ins><code><ins class="diff-chg">
@vocab
</ins></code>,<ins class="diff-chg">
return
the
result
of
using
the
</ins><a href="#iri-compaction"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
compaction
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN">
active
context
</a>,
<a href="#dfn-inverse-context" title="inverse-context" class="tref internalDFN">
<ins class="diff-new">inverse
context
</ins></a>,<ins class="diff-new">
the
value
of
the
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
member
for
</ins><i><ins class="diff-new">
iri
</ins></i>,<ins class="diff-new">
and
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-new">
true
</ins>
</a>
<ins class="diff-new">for
</ins><i><ins class="diff-new">
vocab
</ins></i>.</li><li><ins class="diff-new">
Otherwise,
return
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
as
is.
</ins></li></ol></li><li><ins class="diff-new">
Otherwise,
if
</ins><i><ins class="diff-new">
value
</ins></i>
has
<del class="diff-old">a
default
language
</del>
<ins class="diff-chg">an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
whose
value
matches
the
</ins><a href="#dfn-type-mapping" title="type-mapping" class="tref internalDFN"><ins class="diff-chg">
type
mapping
</ins>
</a>
<del class="diff-old">and
</del>
<ins class="diff-chg">of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
return
</ins>
the
value
<ins class="diff-chg">associated
with
the
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
value
</ins></i>.</li><li><ins class="diff-chg">
Otherwise,
if
</ins><i><ins class="diff-chg">
value
</ins></i>
has
<del class="diff-old">a
corresponding
</del>
<ins class="diff-chg">an
</ins>
<code>
@language
</code>
<del class="diff-old">member,
remove
</del>
<ins class="diff-chg">member
whose
value
matches
the
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-chg">
language
mapping
</ins></a><ins class="diff-chg">
of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>,<ins class="diff-chg">
return
the
value
associated
with
</ins>
the
<code>
<del class="diff-old">@language
</del>
<ins class="diff-chg">@value
</ins>
</code>
member
<del class="diff-old">from
</del>
<ins class="diff-chg">of
</ins><i>
value
<del class="diff-old">.
</del>
</i>.
</li>
<li>
Otherwise,
<del class="diff-old">or
</del>
if
<i>
<ins class="diff-new">number
members
</ins></i><ins class="diff-new">
equals
</ins><code><ins class="diff-new">
1
</ins></code><ins class="diff-new">
and
either
</ins>
the
value
of
<del class="diff-old">value's
</del>
<ins class="diff-chg">the
</ins>
<code>
@value
</code>
member
is
<ins class="diff-new">not
</ins>
a
<a href="#dfn-string" title="string" class="tref internalDFN">
string
</a>,
<ins class="diff-new">or
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a><ins class="diff-new">
has
no
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-new">
default
language
</ins></a>,<ins class="diff-new">
or
the
</ins><a href="#dfn-language-mapping" title="language-mapping" class="tref internalDFN"><ins class="diff-new">
language
mapping
</ins></a><ins class="diff-new">
of
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a><ins class="diff-new">
is
set
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>,,
return
<del class="diff-old">value
.
If
</del>
<ins class="diff-chg">the
</ins>
value
<del class="diff-old">has
just
a
</del>
<ins class="diff-chg">associated
with
the
</ins>
<code>
@value
</code>
<del class="diff-old">member,
return
the
value
of
that
</del>
member.
</li>
<li>
<del class="diff-old">Return
</del>
<ins class="diff-chg">Otherwise,
return
</ins><i>
value
</i>
as
is.
</li>
</ol>
</section>
</section>
</section>
<section id="flattening-algorithms">
<h2>
<span class="secno">
<ins class="diff-chg">9.
</ins></span><ins class="diff-chg">
Flattening
Algorithms
</ins></h2><section id="flattening-algorithm">
<h3>
<span class="secno">
<del class="diff-old">5.13
</del>
<ins class="diff-chg">9.1
</ins>
</span>
<del class="diff-old">Find
and
Remove
Property
Generator
Duplicates
</del>
<ins class="diff-chg">Flattening
Algorithm
</ins>
</h3>
<p>
This
algorithm
<del class="diff-old">checks
if
a
specific
value
exists
for
</del>
<ins class="diff-chg">flattens
an
expanded
JSON-LD
document
by
collecting
</ins>
all
<del class="diff-old">IRIs
</del>
<ins class="diff-chg">properties
of
a
</ins><a href="#dfn-node" title="node" class="tref internalDFN"><ins class="diff-chg">
node
</ins>
</a>
<del class="diff-old">associated
with
</del>
<ins class="diff-chg">in
</ins>
a
<del class="diff-old">property
generator
</del>
<ins class="diff-chg">single
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins>
</a>
and
<del class="diff-old">if
so,
it
removes
them.
The
algorithm
takes
five
parameters:
element
,
property
,
value
,
active
context
,
active
property
.
For
each
item
propertyGenerator
of
the
array
</del>
<ins class="diff-chg">labeling
all
</ins><a href="#dfn-blank-node" title="blank-node" class="tref internalDFN"><ins class="diff-chg">
blank
nodes
</ins>
</a>
<del class="diff-old">which
is
the
value
</del>
<ins class="diff-chg">with
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifiers
</ins></a>.<ins class="diff-chg">
This
resulting
uniform
shape
</ins>
of
the
<del class="diff-old">propertyGenerators
member
of
active
property
perform
</del>
<ins class="diff-chg">document,
may
drastically
simplify
</ins>
the
<del class="diff-old">following
steps:
Check
that
a
member
exists
for
each
</del>
<ins class="diff-chg">code
required
to
process
JSON-LD
data
in
certain
applications.
</ins></p><section class="informative"><h4 id="general-solution-10"><ins class="diff-chg">
General
Solution
</ins></h4>
<del class="diff-old">IRI
</del>
<p>
<del class="diff-old">associated
with
the
propertyGenerator
.
If
</del>
<em>
<del class="diff-old">value
</del>
<ins class="diff-chg">This
section
is
non-normative.
</ins>
</em>
</p>
<p>
<ins class="diff-new">First,
a
</ins><i><ins class="diff-new">
node
map
</ins></i>
is
<del class="diff-old">not
null
also
check
whether
each
of
those
members
that
contains
value
.
Values
are
considered
to
be
equal
if
they
are
of
the
same
type
and
have
</del>
<ins class="diff-chg">generated
using
</ins>
the
<del class="diff-old">same
value(s);
node
objects
</del>
<a href="#node-map-generation">
<ins class="diff-chg">Node
Map
Generation
algorithm
</ins>
</a>
<del class="diff-old">are
considered
to
be
equal
if
</del>
<ins class="diff-chg">which
collects
</ins>
all
<del class="diff-old">members
match,
except
if
no
@id
member
exists
(i.e.,
it
is
an
unlabeled
blank
node
,
in
that
case
</del>
<ins class="diff-chg">properties
of
a
</ins><a href="#dfn-node" title="node" class="tref internalDFN">
node
<del class="diff-old">objects
</del>
</a>
<del class="diff-old">are
never
considered
to
be
equal.
If
that's
not
the
case,
continue
with
</del>
<ins class="diff-chg">in
a
single
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>.<ins class="diff-chg">
In
</ins>
the
next
<del class="diff-old">propertyGenerator
.
Otherwise,
remove
value
from
every
member.
If
</del>
<ins class="diff-chg">step,
</ins>
the
<del class="diff-old">resulting
value
of
a
member
</del>
<i>
<ins class="diff-chg">node
map
</ins></i>
is
<del class="diff-old">an
empty
array
,
remove
the
member
altogether
from
element
.
Return
propertyGenerator
.
Return
the
value
of
the
term
member
of
active
property
since
no
matching
property
generator
</del>
<ins class="diff-chg">converted
to
a
JSON-LD
document
in
</ins><a href="../json-ld/#flattened-document-form" title="flattened-document-form" class="tref externalDFN"><ins class="diff-chg">
flattened
document
form
</ins></a>.<ins class="diff-chg">
Finally,
if
a
</ins><a href="#dfn-context" title="context" class="tref internalDFN"><ins class="diff-chg">
context
</ins>
</a>
has
been
<del class="diff-old">found.
</del>
<ins class="diff-chg">passed,
the
flattened
document
is
compacted
using
the
</ins><a href="#compaction-algorithm"><ins class="diff-chg">
Compaction
algorithm
</ins></a><ins class="diff-chg">
before
being
returned.
</ins></p>
</section>
<del class="diff-old">5.14
Flattening
</del>
<section>
<h4 id="algorithm-10">
Algorithm
</h4>
<p>
The
algorithm
takes
two
input
variables,
an
<i>
element
</i>
to
flatten
and
<del class="diff-old">a
</del>
<ins class="diff-chg">an
optional
</ins><i>
context
</i>
used
to
compact
the
flattened
document.
<ins class="diff-new">If
not
passed,
</ins><i><ins class="diff-new">
context
</ins></i><ins class="diff-new">
is
set
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>.
</p>
<ol class="algorithm">
<li>
<del class="diff-old">Expand
element
according
the
Expansion
algorithm
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
node
map
</ins></i><ins class="diff-chg">
to
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><ins class="diff-chg">
consisting
of
a
single
member
whose
key
is
</ins><code><ins class="diff-chg">
@default
</ins></code><ins class="diff-chg">
and
whose
value
is
an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins>
</a>.
</li>
<li>
<del class="diff-old">Generate
a
nodeMap
according
</del>
<ins class="diff-chg">Perform
</ins>
the
<a href="#node-map-generation">
Node
Map
Generation
algorithm
<del class="diff-old">.
</del>
</a>,
<ins class="diff-chg">passing
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
node
map
</ins></i>.
</li>
<li>
<del class="diff-old">Let
defaultGraph
be
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
default
graph
</ins></i><ins class="diff-chg">
to
</ins>
the
value
of
the
<code>
@default
</code>
member
of
<del class="diff-old">nodeMap
;
</del>
<i>
<ins class="diff-chg">node
map
</ins></i>,<ins class="diff-chg">
which
is
</ins>
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
representing
the
<a href="#dfn-default-graph" title="default-graph" class="tref internalDFN">
default
graph
</a>.
</li>
<li>
For
each
<del class="diff-old">other
graphName
</del>
<ins class="diff-chg">key-value
pair
</ins><i><ins class="diff-chg">
graph
name
</ins></i>
-
<i>
graph
<del class="diff-old">pair
</del>
</i>
in
<del class="diff-old">nodeMap
</del>
<i>
<ins class="diff-chg">node
map
</ins></i><ins class="diff-chg">
where
</ins><i><ins class="diff-chg">
graph
name
</ins></i><ins class="diff-chg">
is
not
</ins><code><ins class="diff-chg">
@default
</ins></code>,
perform
the
following
steps:
<ol class="algorithm">
<li>
If
<del class="diff-old">defaultGraph
</del>
<i>
<ins class="diff-chg">default
graph
</ins></i>
does
not
have
a
<del class="diff-old">graphName
</del>
<i>
<ins class="diff-chg">graph
name
</ins></i>
member,
create
one
and
initialize
its
value
to
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
consisting
of
an
<code>
@id
</code>
member
whose
value
is
set
to
<del class="diff-old">graphName
.
</del>
<i>
<ins class="diff-chg">graph
name
</ins></i>.</li><li><ins class="diff-chg">
Reference
the
value
associated
with
the
</ins><i><ins class="diff-chg">
graph
name
</ins></i><ins class="diff-chg">
member
in
</ins><i><ins class="diff-chg">
default
graph
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
entry
</ins></i>.
</li>
<li>
Add
<del class="diff-old">a
</del>
<ins class="diff-chg">an
</ins>
<code>
@graph
</code>
member
<ins class="diff-new">to
</ins><i><ins class="diff-new">
entry
</ins></i><ins class="diff-new">
and
</ins>
set
<ins class="diff-new">it
</ins>
to
an
empty
<a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">(referred
to
as
nodes
)
to
the
JSON
object
which
is
the
value
of
the
graphName
member
of
nodeMap
.
</del>
</a>.
</li>
<li>
For
each
<i>
id
</i>
-
<i>
node
</i>
pair
in
<i>
graph
</i>
ordered
by
<i>
id
<del class="diff-old">,
</del>
</i>,
add
<i>
node
</i>
to
the
<del class="diff-old">nodes
array
.
</del>
<code>
<ins class="diff-chg">@graph
</ins></code><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
entry
</ins></i>.
</li>
</ol>
</li>
<li>
Initialize
an
empty
<a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>
<del class="diff-old">flattened.
</del>
<i>
<ins class="diff-chg">flattened
</ins></i>.
</li>
<li>
For
each
<i>
id
</i>
-
<i>
node
</i>
pair
in
<del class="diff-old">defaultGraph
</del>
<i>
<ins class="diff-chg">default
graph
</ins></i>
ordered
by
<i>
id
<del class="diff-old">,
</del>
</i>,
add
<i>
node
</i>
to
<i>
flattened
<del class="diff-old">.
</del>
</i>.
</li>
<li>
If
<i>
context
<del class="diff-old">equals
</del>
</i>
<ins class="diff-chg">is
</ins><a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>,
return
<i>
flattened
<del class="diff-old">.
</del>
</i>.
</li>
<li>
Otherwise,
return
the
result
of
compacting
<i>
flattened
</i>
according
the
<a href="#compaction-algorithm">
Compaction
algorithm
</a>
passing
<i>
context
</i>
ensuring
that
the
compaction
result
uses
the
<code>
@graph
</code>
keyword
(or
its
alias)
at
the
top-level,
even
if
the
context
is
empty
or
if
there
is
only
one
element
to
put
in
the
<code>
@graph
</code>
<a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>.
This
ensures
that
the
returned
document
has
a
deterministic
structure.
</li>
</ol>
</section>
</section>
<section id="node-map-generation">
<h3>
<span class="secno">
<del class="diff-old">5.15
</del>
<ins class="diff-chg">9.2
</ins>
</span>
Node
Map
Generation
</h3>
<p>
This
algorithm
creates
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<del class="diff-old">nodeMap
</del>
<i>
<ins class="diff-chg">node
map
</ins></i>
holding
an
indexed
representation
of
the
<a href="#dfn-json-ld-graph" title="json-ld-graph" class="tref internalDFN">
graphs
</a>
and
<a href="#dfn-node" title="node" class="tref internalDFN">
nodes
</a>
represented
in
the
<del class="diff-old">passed,
</del>
<ins class="diff-chg">passed
</ins>
expanded
document.
All
<a href="#dfn-node" title="node" class="tref internalDFN">
nodes
</a>
that
are
not
uniquely
identified
by
an
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
get
assigned
a
(new)
<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
identifier
</a>.
The
resulting
<del class="diff-old">nodeMap
</del>
<i>
<ins class="diff-chg">node
map
</ins></i>
will
have
a
member
for
every
graph
in
the
document
whose
value
is
another
object
with
a
member
for
every
<a href="#dfn-node" title="node" class="tref internalDFN">
node
</a>
represented
in
the
document.
The
default
graph
is
stored
under
the
<code>
@default
</code>
member,
all
other
graphs
are
stored
under
their
<a href="#dfn-graph-name" title="graph-name" class="tref internalDFN">
graph
<del class="diff-old">name.
</del>
<ins class="diff-chg">name
</ins></a>.</p><section class="informative"><h4 id="general-solution-11"><ins class="diff-chg">
General
Solution
</ins></h4><p><em><ins class="diff-chg">
This
section
is
non-normative.
</ins></em></p><p><ins class="diff-chg">
The
algorithm
recursively
runs
over
an
expanded
JSON-LD
document
to
collect
all
</ins><a href="#dfn-property" title="property" class="tref internalDFN"><ins class="diff-chg">
properties
</ins></a><ins class="diff-chg">
of
a
</ins><a href="#dfn-node" title="node" class="tref internalDFN"><ins class="diff-chg">
node
</ins></a><ins class="diff-chg">
in
a
single
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>.<ins class="diff-chg">
The
algorithm
constructs
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a><i><ins class="diff-chg">
node
map
</ins></i><ins class="diff-chg">
whose
keys
represent
the
</ins><a href="#dfn-graph-name" title="graph-name" class="tref internalDFN"><ins class="diff-chg">
graph
names
</ins></a><ins class="diff-chg">
used
in
the
document
(the
</ins><a href="#dfn-default-graph" title="default-graph" class="tref internalDFN"><ins class="diff-chg">
default
graph
</ins></a><ins class="diff-chg">
is
stored
under
the
key
</ins><code><ins class="diff-chg">
@default
</ins></code><ins class="diff-chg">
)
and
whose
associated
values
are
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
objects
</ins></a><ins class="diff-chg">
which
index
the
</ins><a href="#dfn-node" title="node" class="tref internalDFN"><ins class="diff-chg">
nodes
</ins></a><ins class="diff-chg">
in
the
</ins><a href="#dfn-json-ld-graph" title="json-ld-graph" class="tref internalDFN"><ins class="diff-chg">
graph
</ins></a>.<ins class="diff-chg">
If
a
</ins><a href="#dfn-property" title="property" class="tref internalDFN"><ins class="diff-chg">
property's
</ins></a><ins class="diff-chg">
value
is
a
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-chg">
node
object
</ins></a>,<ins class="diff-chg">
it
is
replace
by
a
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-chg">
node
object
</ins></a><ins class="diff-chg">
consisting
of
only
an
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member.
If
a
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-chg">
node
object
</ins></a><ins class="diff-chg">
has
no
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member
or
it
is
identified
by
a
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a>,<ins class="diff-chg">
a
new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a><ins class="diff-chg">
is
generated.
This
relabeling
of
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifiers
</ins></a><ins class="diff-chg">
is
also
be
done
for
</ins><a href="#dfn-property" title="property" class="tref internalDFN"><ins class="diff-chg">
properties
</ins></a><ins class="diff-chg">
and
values
of
</ins><code><ins class="diff-chg">
@type
</ins></code>.
</p>
</section>
<section>
<h4 id="algorithm-11">
<ins class="diff-new">Algorithm
</ins></h4>
<p>
The
algorithm
takes
as
input
an
expanded
JSON-LD
document
<i>
element
</i>
and
a
reference
to
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<del class="diff-old">nodeMap
.
</del>
<i>
<ins class="diff-chg">node
map
</ins></i>.
Furthermore
it
has
the
optional
parameters
<a href="#dfn-active-graph" title="active-graph" class="tref internalDFN">
active
graph
</a>
(which
defaults
to
<code>
@default
</code>
),
an
<a href="#dfn-active-subject" title="active-subject" class="tref internalDFN">
active
subject
</a>,
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>,
and
a
reference
to
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<i>
list
<del class="diff-old">.
The
nodeMap
must
be
initialized
to
a
JSON
object
consisting
of
a
single
member
whose
name
corresponds
with
</del>
</i>.
<ins class="diff-chg">If
not
passed,
</ins><a href="#dfn-active-subject" title="active-subject" class="tref internalDFN">
active
<del class="diff-old">graph
</del>
<ins class="diff-chg">subject
</ins></a>,<a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-chg">
active
property
</ins></a>,
and
<del class="diff-old">whose
value
is
an
empty
JSON
object
</del>
<i>
<ins class="diff-chg">list
</ins></i><ins class="diff-chg">
are
set
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins>
</a>.
</p>
<ol class="algorithm">
<li>
If
<i>
element
</i>
is
an
array,
process
each
<del class="diff-old">entry
</del>
<i>
<ins class="diff-chg">item
</ins></i>
in
<i>
element
<del class="diff-old">recursively,
using
</del>
</i>
<ins class="diff-chg">as
follows
and
then
return:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Run
</ins>
this
algorithm
<ins class="diff-new">recursively
by
passing
</ins><i><ins class="diff-new">
item
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
element
</ins></i>,<i><ins class="diff-new">
node
map
</ins></i>,<a href="#dfn-active-graph" title="active-graph" class="tref internalDFN"><ins class="diff-new">
active
graph
</ins></a>,<a href="#dfn-active-subject" title="active-subject" class="tref internalDFN"><ins class="diff-new">
active
subject
</ins></a>,<a href="#dfn-active-property" title="active-property" class="tref internalDFN"><ins class="diff-new">
active
property
</ins></a>,
and
<del class="diff-old">return.
</del>
<i>
<ins class="diff-chg">list
</ins></i>.</li></ol>
</li>
<li>
Otherwise
<i>
element
</i>
is
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>.
<del class="diff-old">Let
activeGraph
be
</del>
<ins class="diff-chg">Reference
</ins>
the
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
which
is
the
value
of
the
<a href="#dfn-active-graph" title="active-graph" class="tref internalDFN">
active
graph
</a>
member
of
<del class="diff-old">nodeMap
.
</del>
<i>
<ins class="diff-chg">node
map
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
graph
</ins></i>.<ins class="diff-chg">
If
the
</ins><a href="#dfn-active-subject" title="active-subject" class="tref internalDFN"><ins class="diff-chg">
active
subject
</ins></a><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
</ins><i><ins class="diff-chg">
node
</ins></i><ins class="diff-chg">
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
otherwise
reference
the
</ins><a href="#dfn-active-subject" title="active-subject" class="tref internalDFN"><ins class="diff-chg">
active
subject
</ins></a><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
graph
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
node
</ins></i>.
</li>
<li>
If
<del class="diff-old">it
</del>
<i>
<ins class="diff-chg">element
</ins></i>
has
<del class="diff-old">a
</del>
<ins class="diff-chg">an
</ins>
<code>
@type
</code>
member,
perform
for
each
<i>
item
</i>
the
following
steps:
<ol class="algorithm">
<li>
If
<i>
item
</i>
is
a
<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
identifier
</a>,
replace
it
with
a
<ins class="diff-new">newly
</ins>
<a href="#generate-blank-node-identifier">
<del class="diff-old">new
</del>
<ins class="diff-chg">generated
</ins>
blank
node
identifier
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">passing
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
identifier
</ins></i>.
</li>
<li>
If
<del class="diff-old">activeGraph
</del>
<i>
<ins class="diff-chg">graph
</ins></i>
has
no
member
<i>
item
<del class="diff-old">,
</del>
</i>,
create
<del class="diff-old">it
</del>
<ins class="diff-chg">one
</ins>
and
initialize
its
value
to
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
consisting
of
a
single
member
<code>
@id
</code>
<del class="diff-old">with
the
</del>
<ins class="diff-chg">whose
</ins>
value
<ins class="diff-chg">is
</ins><i>
item
<del class="diff-old">.
</del>
</i>.
</li>
</ol>
</li>
<li>
If
<i>
element
</i>
has
an
<code>
@value
</code>
member,
perform
the
following
steps:
<ol class="algorithm">
<li>
If
<del class="diff-old">active
property
</del>
<i>
<ins class="diff-chg">list
</ins></i>
is
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>,
<del class="diff-old">generate
a
blank
node
identifier
id
and
store
element
as
value
of
the
member
id
in
activeGraph
.
Issue
207
Handling
of
free-floating
values
is
still
being
discussed.
Otherwise,
if
no
list
has
been
passed,
</del>
merge
<i>
element
</i>
into
the
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
member
of
<i>
<ins class="diff-new">node
</ins></i><ins class="diff-new">
;
</ins>
the
<del class="diff-old">active
subject
</del>
<ins class="diff-chg">resulting
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">in
activeGraph
.
</del>
<ins class="diff-chg">must
not
contain
any
duplicate
values.
</ins>
</li>
<li>
Otherwise,
append
<i>
element
</i>
to
the
<code>
@list
</code>
member
of
<i>
list
<del class="diff-old">.
</del>
</i>.
</li>
</ol>
</li>
<li>
Otherwise,
if
<i>
element
</i>
has
an
<code>
@list
</code>
member,
perform
the
following
steps:
<ol class="algorithm">
<li>
Initialize
a
new
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<i>
result
<del class="diff-old">having
</del>
</i>
<ins class="diff-chg">consisting
of
</ins>
a
single
member
<code>
@list
</code>
whose
value
is
initialized
to
an
empty
<a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>.
</li>
<li>
Recursively
call
this
algorithm
passing
the
value
of
<i>
element's
</i>
<code>
@list
</code>
member
<del class="diff-old">as
new
</del>
<ins class="diff-chg">for
</ins><i>
element
<del class="diff-old">and
result
as
list
.
If
</del>
</i>,
<a href="#dfn-active-graph" title="active-graph" class="tref internalDFN">
<ins class="diff-chg">active
graph
</ins></a>,<a href="#dfn-active-subject" title="active-subject" class="tref internalDFN"><ins class="diff-chg">
active
subject
</ins></a>,<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
<del class="diff-old">is
null
</del>
</a>,
<del class="diff-old">generate
a
blank
node
identifier
id
</del>
and
<del class="diff-old">store
</del>
<i>
result
<del class="diff-old">as
value
of
the
member
id
in
activeGraph
.
Issue
207
Handling
of
free-floating
values
is
still
being
discussed.
</del>
</i>
<ins class="diff-chg">for
</ins><i><ins class="diff-chg">
list
</ins></i>.
</li>
<li>
<del class="diff-old">Otherwise,
add
</del>
<ins class="diff-chg">Append
</ins><i>
result
</i>
to
the
the
value
of
the
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
member
of
<del class="diff-old">the
active
subject
in
activeGraph
.
</del>
<i>
<ins class="diff-chg">node
</ins></i>.
</li>
</ol>
</li>
<li>
Otherwise
<i>
element
</i>
is
a
<a href="#dfn-node-object" title="node-object" class="tref internalDFN">
node
object
</a>,
perform
the
following
steps:
<ol class="algorithm">
<li>
If
<i>
element
</i>
has
an
<code>
@id
</code>
member,
<del class="diff-old">store
</del>
<ins class="diff-chg">set
</ins><i><ins class="diff-chg">
id
</ins></i><ins class="diff-chg">
to
</ins>
its
value
<del class="diff-old">in
id
</del>
and
remove
the
member
from
<i>
element
<del class="diff-old">.
</del>
</i>.
If
<i>
id
</i>
is
a
<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
identifier
</a>,
replace
it
with
a
<del class="diff-old">new
</del>
<ins class="diff-chg">newly
</ins><a href="#generate-blank-node-identifier"><ins class="diff-chg">
generated
</ins>
blank
node
identifier
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">passing
</ins><i><ins class="diff-chg">
id
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
identifier
</ins></i>.
</li>
<li>
<del class="diff-old">Otherwise
</del>
<ins class="diff-chg">Otherwise,
set
</ins><i><ins class="diff-chg">
id
</ins></i><ins class="diff-chg">
to
the
result
of
the
</ins>
<a href="#generate-blank-node-identifier">
<del class="diff-old">generate
a
new
blank
node
identifier
</del>
<ins class="diff-chg">Generate
Blank
Node
Identifier
algorithm
</ins>
</a>
<del class="diff-old">and
store
it
as
id
.
</del>
<ins class="diff-chg">passing
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
identifier
</ins></i>.
</li>
<li>
If
<del class="diff-old">activeGraph
</del>
<i>
<ins class="diff-chg">graph
</ins></i>
does
not
contain
a
member
<i>
id
<del class="diff-old">,
</del>
</i>,
create
one
and
initialize
<del class="diff-old">it
</del>
<ins class="diff-chg">its
value
</ins>
to
a
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
consisting
of
a
single
member
<code>
@id
</code>
whose
value
is
<del class="diff-old">set
to
</del>
<i>
id
<del class="diff-old">.
</del>
</i>.
</li>
<li>
If
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
is
not
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>,
perform
the
following
steps:
<ol class="algorithm">
<li>
Create
a
new
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<i>
reference
</i>
consisting
of
a
single
member
<code>
@id
</code>
whose
value
is
<i>
id
<del class="diff-old">.
</del>
</i>.
</li>
<li>
If
<del class="diff-old">no
</del>
<i>
list
<del class="diff-old">has
been
passed,
</del>
</i>
<ins class="diff-chg">is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,
merge
<i>
element
</i>
into
the
<a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
</a>
member
of
<i>
<ins class="diff-new">node
</ins></i><ins class="diff-new">
;
</ins>
the
<del class="diff-old">active
subject
</del>
<ins class="diff-chg">resulting
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">in
activeGraph
.
</del>
<ins class="diff-chg">must
not
contain
any
duplicate
values.
</ins>
</li>
<li>
Otherwise,
append
<i>
element
</i>
to
the
<code>
@list
</code>
member
of
<i>
list
<del class="diff-old">.
</del>
</i>.
</li>
</ol>
</li>
<li>
<ins class="diff-new">Reference
the
value
of
the
</ins><i><ins class="diff-new">
id
</ins></i><ins class="diff-new">
member
of
</ins><i><ins class="diff-new">
graph
</ins></i><ins class="diff-new">
using
the
variable
</ins><i><ins class="diff-new">
node
</ins></i>.</li><li>
If
<i>
element
</i>
has
an
<code>
@type
</code>
member,
merge
each
<del class="diff-old">value
</del>
<ins class="diff-chg">of
its
values
</ins>
into
the
<code>
@type
</code>
<ins class="diff-new">member
</ins>
of
<del class="diff-old">active
subject
in
activeGraph
.
Then
</del>
<i>
<ins class="diff-chg">node
</ins></i><ins class="diff-chg">
and
finally
</ins>
remove
the
<code>
@type
</code>
member
from
<i>
element
<del class="diff-old">.
</del>
</i>
<ins class="diff-chg">;
the
resulting
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
must
not
contain
any
duplicate
values.
</ins>
</li>
<li>
If
<i>
element
</i>
has
an
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@index
</ins>
</code>
member,
set
the
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@index
</ins>
</code>
<ins class="diff-new">member
</ins>
of
<del class="diff-old">active
subject
in
activeGraph
</del>
<i>
<ins class="diff-chg">node
</ins></i>
to
its
value.
If
<del class="diff-old">such
a
member
already
exists
in
active
subject
</del>
<a href="#dfn-node" title="node" class="tref internalDFN">
<ins class="diff-chg">node
</ins>
</a>
<del class="diff-old">and
</del>
has
<ins class="diff-new">already
an
</ins><code><ins class="diff-new">
@index
</ins></code><ins class="diff-new">
member
with
</ins>
a
different
value,
<del class="diff-old">raise
</del>
a
<code class="error">
<del class="diff-old">CONFLICTING_ANNOTATION
</del>
<a href="#idl-def-JsonLdErrorCode.conflicting-indexes">
<ins class="diff-chg">conflicting
indexes
</ins></a>
</code>
<del class="diff-old">error.
Otherwise
</del>
<ins class="diff-chg">error
has
been
detected
and
processing
is
aborted.
Otherwise,
</ins>
continue
<ins class="diff-new">by
removing
the
</ins><code><ins class="diff-new">
@index
</ins></code><ins class="diff-new">
member
from
</ins><i><ins class="diff-new">
element
</ins></i>.</li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
element
</ins></i><ins class="diff-new">
has
an
</ins><code><ins class="diff-new">
@reverse
</ins></code><ins class="diff-new">
member:
</ins><ol class="algorithm"><li><ins class="diff-new">
Create
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><i><ins class="diff-new">
referenced
node
</ins></i><ins class="diff-new">
with
a
single
member
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
whose
value
is
</ins><i><ins class="diff-new">
id
</ins></i>.</li><li><ins class="diff-new">
Set
</ins><i><ins class="diff-new">
reverse
map
</ins></i><ins class="diff-new">
to
the
value
of
the
</ins><code><ins class="diff-new">
@reverse
</ins></code><ins class="diff-new">
member
of
</ins><i><ins class="diff-new">
element
</ins></i>.</li><li><ins class="diff-new">
For
each
key-value
pair
</ins><i><ins class="diff-new">
property
</ins></i><ins class="diff-new">
-
</ins><i><ins class="diff-new">
values
</ins></i><ins class="diff-new">
in
</ins><i><ins class="diff-new">
reverse
map
</ins></i>:<ol class="algorithm"><li><ins class="diff-new">
For
each
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
of
</ins><i><ins class="diff-new">
values
</ins></i>:<ol class="algorithm"><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
has
a
</ins><i><ins class="diff-new">
property
</ins></i><ins class="diff-new">
member,
append
</ins><i><ins class="diff-new">
referenced
node
</ins></i><ins class="diff-new">
to
its
value;
otherwise
create
a
</ins><i><ins class="diff-new">
property
</ins></i><ins class="diff-new">
member
whose
value
is
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a><ins class="diff-new">
containing
</ins><i><ins class="diff-new">
referenced
node
</ins></i>.</li><li><ins class="diff-new">
Recursively
invoke
this
algorithm
passing
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
element
</ins></i>,<i><ins class="diff-new">
node
map
</ins></i>,
and
<del class="diff-old">remove
</del>
<a href="#dfn-active-graph" title="active-graph" class="tref internalDFN">
<ins class="diff-chg">active
graph
</ins></a>.</li></ol></li></ol></li><li><ins class="diff-chg">
Remove
</ins>
the
<code>
<del class="diff-old">@annotation
</del>
<ins class="diff-chg">@reverse
</ins>
</code>
<ins class="diff-new">member
</ins>
from
<i>
element
<del class="diff-old">.
</del>
</i>.
</li>
</ol>
</li>
<li>
If
<i>
element
</i>
has
an
<code>
@graph
</code>
member,
recursively
invoke
this
algorithm
passing
the
value
of
the
<code>
@graph
</code>
member
<del class="diff-old">as
new
</del>
<ins class="diff-chg">for
</ins><i>
element
</i>,
<i>
<ins class="diff-chg">node
map
</ins></i>,
and
<i>
id
<del class="diff-old">as
new
</del>
</i>
<ins class="diff-chg">for
</ins><a href="#dfn-active-graph" title="active-graph" class="tref internalDFN">
active
<del class="diff-old">subject
.
Then
remove
</del>
<ins class="diff-chg">graph
</ins></a><ins class="diff-chg">
before
removing
</ins>
the
<code>
@graph
</code>
member
from
<i>
element
<del class="diff-old">.
</del>
</i>.
</li>
<li>
<del class="diff-old">Finally
</del>
<ins class="diff-chg">Finally,
</ins>
for
each
<ins class="diff-chg">key-value
pair
</ins><i>
property
</i>
-
<i>
value
<del class="diff-old">pair
</del>
</i>
in
<i>
element
</i>
ordered
by
<i>
property
</i>
perform
the
following
steps:
<ol class="algorithm">
<li>
If
<del class="diff-old">no
</del>
<i>
property
<del class="diff-old">member
exists
in
the
JSON
object
which
</del>
</i>
is
<del class="diff-old">the
value
of
the
id
member
of
activeGraph
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a>,<ins class="diff-chg">
replace
it
with
a
newly
</ins><a href="#generate-blank-node-identifier"><ins class="diff-chg">
generated
blank
node
identifier
</ins></a><ins class="diff-chg">
passing
</ins><i><ins class="diff-chg">
property
</ins></i><ins class="diff-chg">
for
</ins><i><ins class="diff-chg">
identifier
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
node
</ins></i><ins class="diff-chg">
does
not
have
a
</ins><i><ins class="diff-chg">
property
</ins></i><ins class="diff-chg">
member,
</ins>
create
<del class="diff-old">the
member
</del>
<ins class="diff-chg">one
</ins>
and
initialize
its
value
to
an
empty
<a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>.
</li>
<li>
Recursively
invoke
this
algorithm
passing
<i>
value
<del class="diff-old">as
new
</del>
</i>
<ins class="diff-chg">for
</ins><i>
element
<del class="diff-old">,
</del>
</i>,
<i>
<ins class="diff-chg">node
map
</ins></i>,<a href="#dfn-active-graph" title="active-graph" class="tref internalDFN"><ins class="diff-chg">
active
graph
</ins></a>,<i>
id
<del class="diff-old">as
new
</del>
</i>
<ins class="diff-chg">for
</ins><a href="#dfn-active-subject" title="active-subject" class="tref internalDFN">
active
subject
</a>,
<del class="diff-old">and
</del>
<i>
property
<del class="diff-old">as
new
</del>
</i>
<ins class="diff-chg">for
</ins><a href="#dfn-active-property" title="active-property" class="tref internalDFN">
active
property
<del class="diff-old">.
</del>
</a>,
<ins class="diff-chg">and
</ins><i><ins class="diff-chg">
list
</ins></i>.
</li>
</ol>
</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="generate-blank-node-identifier">
<h3>
<span class="secno">
<del class="diff-old">5.16
</del>
<ins class="diff-chg">9.3
</ins>
</span>
<del class="diff-old">RDF
Conversion
Algorithms
</del>
<ins class="diff-chg">Generate
Blank
Node
Identifier
</ins>
</h3>
<p>
This
<del class="diff-old">specification
describes
algorithms
</del>
<ins class="diff-chg">algorithm
is
used
</ins>
to
<del class="diff-old">transform
JSON-LD
documents
</del>
<ins class="diff-chg">generate
new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifiers
</ins></a><ins class="diff-chg">
or
</ins>
to
<ins class="diff-new">relabel
</ins>
an
<del class="diff-old">array
of
RDF
quads
</del>
<ins class="diff-chg">existing
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins>
</a>
<del class="diff-old">and
vice-versa.
Note
that
many
uses
of
JSON-LD
may
not
require
generation
</del>
<ins class="diff-chg">to
avoid
collision
by
the
introduction
</ins>
of
<del class="diff-old">RDF.
</del>
<ins class="diff-chg">new
ones.
</ins></p><section class="informative"><h4 id="general-solution-12"><ins class="diff-chg">
General
Solution
</ins></h4><p><em><ins class="diff-chg">
This
section
is
non-normative.
</ins></em>
</p>
<p>
The
<del class="diff-old">processing
algorithms
described
</del>
<ins class="diff-chg">simplest
case
is
if
there
exists
already
a
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a>
in
<del class="diff-old">this
section
are
provided
</del>
<ins class="diff-chg">the
</ins><i><ins class="diff-chg">
identifier
map
</ins></i><ins class="diff-chg">
for
the
passed
</ins><i><ins class="diff-chg">
identifier
</ins></i>,
in
<del class="diff-old">order
to
demonstrate
how
</del>
<ins class="diff-chg">which
case
it
is
simply
returned.
Otherwise,
a
new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a><ins class="diff-chg">
is
generated
by
concatenating
the
string
</ins><code><ins class="diff-chg">
_:b
</ins></code><ins class="diff-chg">
and
the
</ins><i><ins class="diff-chg">
counter
</ins></i>.<ins class="diff-chg">
If
the
passed
</ins><i><ins class="diff-chg">
identifier
</ins></i><ins class="diff-chg">
is
not
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
an
entry
is
created
in
the
</ins><i><ins class="diff-chg">
identifier
map
</ins></i><ins class="diff-chg">
associating
the
</ins><i><ins class="diff-chg">
identifier
</ins></i><ins class="diff-chg">
with
the
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a>.<ins class="diff-chg">
Finally,
the
</ins><i><ins class="diff-chg">
counter
</ins></i><ins class="diff-chg">
is
increased
by
</ins>
one
<del class="diff-old">might
implement
</del>
<ins class="diff-chg">and
the
new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a><ins class="diff-chg">
is
returned.
</ins></p></section><section><h4 id="algorithm-12"><ins class="diff-chg">
Algorithm
</ins></h4><p><ins class="diff-chg">
The
algorithm
takes
</ins>
a
<del class="diff-old">JSON-LD
</del>
<ins class="diff-chg">single
input
variable
</ins><i><ins class="diff-chg">
identifier
</ins></i><ins class="diff-chg">
which
may
be
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>.<ins class="diff-chg">
Between
its
executions,
the
algorithm
needs
</ins>
to
<del class="diff-old">RDF
processor.
Conformant
implementations
are
only
required
</del>
<ins class="diff-chg">keep
an
</ins><i><ins class="diff-chg">
identifier
map
</ins></i>
to
<del class="diff-old">produce
the
same
type
</del>
<ins class="diff-chg">relabel
existing
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifiers
</ins></a><ins class="diff-chg">
consistently
</ins>
and
<del class="diff-old">number
of
quads
</del>
<ins class="diff-chg">a
</ins><i><ins class="diff-chg">
counter
</ins></i><ins class="diff-chg">
to
generate
new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifiers
</ins></a>.<ins class="diff-chg">
The
</ins><i><ins class="diff-chg">
counter
</ins></i><ins class="diff-chg">
is
initialized
to
</ins><code><ins class="diff-chg">
0
</ins></code><ins class="diff-chg">
by
default.
</ins></p><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
identifier
</ins></i><ins class="diff-chg">
is
not
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins>
</a>
<del class="diff-old">but
are
</del>
<ins class="diff-chg">and
has
an
entry
in
the
</ins><i><ins class="diff-chg">
identifier
map
</ins></i>,<ins class="diff-chg">
return
the
mapped
identifier.
</ins></li><li><ins class="diff-chg">
Otherwise,
generate
a
new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a><ins class="diff-chg">
by
concatenating
the
string
</ins><code><ins class="diff-chg">
_:b
</ins></code><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
counter
</ins></i>.</li><li><ins class="diff-chg">
Increment
</ins><i><ins class="diff-chg">
counter
</ins></i><ins class="diff-chg">
by
</ins><code><ins class="diff-chg">
1
</ins></code>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
identifier
</ins></i><ins class="diff-chg">
is
</ins>
not
<del class="diff-old">required
</del>
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-chg">null
</ins></a>,<ins class="diff-chg">
create
a
new
entry
for
</ins><i><ins class="diff-chg">
identifier
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
identifier
map
</ins></i><ins class="diff-chg">
and
set
its
value
</ins>
to
<del class="diff-old">implement
</del>
the
<del class="diff-old">algorithm
exactly
as
described.
Issue
This
algorithm
hasn't
been
updated
yet.
</del>
<ins class="diff-chg">new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a>.</li><li><ins class="diff-chg">
Return
the
new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a>.</li></ol></section></section></section><section id="rdf-conversion-algorithms"><h2>
<span class="secno">
<del class="diff-old">5.16.1
</del>
<ins class="diff-chg">10.
</ins>
</span>
<del class="diff-old">Convert
to
</del>
RDF
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">Conversion
Algorithms
</ins></h2>
<p>
<ins class="diff-new">This
section
describes
algorithms
to
transform
a
JSON-LD
document
to
an
</ins><a href="#dfn-rdf-dataset" title="rdf-dataset" class="tref internalDFN"><ins class="diff-new">
RDF
dataset
</ins></a><ins class="diff-new">
and
vice
versa.
</ins>
The
<del class="diff-old">algorithm
below
is
</del>
<ins class="diff-chg">algorithms
are
</ins>
designed
for
in-memory
implementations
with
random
access
to
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
elements.
</p>
<p>
<del class="diff-old">A
conforming
JSON-LD
processor
implementing
RDF
conversion
must
implement
a
processing
algorithm
that
results
in
the
same
set
of
RDF
quads
that
</del>
<ins class="diff-chg">Throughout
this
section,
</ins>
the
following
<del class="diff-old">algorithm
generates:
</del>
<ins class="diff-chg">vocabulary
</ins><a href="#dfn-prefix" title="prefix" class="tref internalDFN"><ins class="diff-chg">
prefixes
</ins></a><ins class="diff-chg">
are
used
in
</ins><a href="#dfn-compact-iri" title="compact-iri" class="tref internalDFN"><ins class="diff-chg">
compact
IRIs
</ins></a>:
</p>
<table rules="all">
<thead>
<tr>
<th>
<ins class="diff-new">Prefix
</ins></th><th><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></th></tr></thead><tbody><tr><td><ins class="diff-new">
rdf
</ins></td><td><ins class="diff-new">
http://www.w3.org/1999/02/22-rdf-syntax-ns#
</ins></td></tr><tr><td><ins class="diff-new">
rdfs
</ins></td><td><ins class="diff-new">
http://www.w3.org/2000/01/rdf-schema#
</ins></td></tr><tr><td><ins class="diff-new">
xsd
</ins></td><td><ins class="diff-new">
http://www.w3.org/2001/XMLSchema#
</ins></td></tr></tbody></table><section id="convert-to-rdf-algorithm"><h3><span class="secno"><ins class="diff-new">
10.1
</ins></span><ins class="diff-new">
Convert
to
RDF
Algorithm
</ins></h3>
<p>
<del class="diff-old">The
algorithm
takes
four
input
variables:
</del>
<ins class="diff-chg">This
algorithms
converts
</ins>
a
<del class="diff-old">element
</del>
<ins class="diff-chg">JSON-LD
document
</ins>
to
<del class="diff-old">be
converted,
</del>
an
<del class="diff-old">active
subject
,
active
property
and
graph
name
</del>
<a href="#dfn-rdf-dataset" title="rdf-dataset" class="tref internalDFN">
<ins class="diff-chg">RDF
dataset
</ins>
</a>.
<del class="diff-old">To
begin,
the
active
subject
,
active
property
</del>
</p>
<div class="issue">
<div class="issue-title">
<a href="https://github.com/json-ld/json-ld.org/issues/217">
<span>
<ins class="diff-chg">Issue
217
</ins></span>
</a>
<del class="diff-old">and
graph
name
</del>
</div>
<p class="">
<ins class="diff-chg">RDF
does
not
currently
allow
a
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins>
</a>
<del class="diff-old">are
set
</del>
to
<del class="diff-old">null
,
and
</del>
<ins class="diff-chg">be
used
as
a
</ins><a href="#dfn-graph-name" title="graph-name" class="tref internalDFN"><ins class="diff-chg">
graph
name
</ins></a>.</p></div><section class="informative"><h4 id="general-solution-13"><ins class="diff-chg">
General
Solution
</ins></h4><p>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">This
section
is
non-normative.
</ins>
</em>
</p>
<p>
<ins class="diff-new">The
JSON-LD
document
</ins>
is
<del class="diff-old">set
</del>
<ins class="diff-chg">expanded
and
converted
</ins>
to
<ins class="diff-new">a
</ins><i><ins class="diff-new">
node
map
</ins></i><ins class="diff-new">
using
</ins>
the
<del class="diff-old">result
of
performing
</del>
<a href="#node-map-generation">
<ins class="diff-chg">Node
Map
Generation
algorithm
</ins></a>.<ins class="diff-chg">
This
allows
each
graph
represented
within
</ins>
the
<del class="diff-old">Expansion
Algorithm
on
</del>
<ins class="diff-chg">document
to
be
extracted
and
flattened,
making
it
easier
to
process
each
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-chg">
node
object
</ins></a>.<ins class="diff-chg">
Each
graph
from
</ins>
the
<del class="diff-old">JSON-LD
input
</del>
<i>
<ins class="diff-chg">node
map
</ins></i><ins class="diff-chg">
is
processed
to
extract
</ins><a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN"><ins class="diff-chg">
RDF
triples
</ins></a>,<ins class="diff-chg">
to
</ins>
which
<ins class="diff-new">any
(non-default)
graph
name
</ins>
is
<del class="diff-old">expected
</del>
<ins class="diff-chg">applied
</ins>
to
<del class="diff-old">be
a
a
well-formed
JSON-LD
document
as
defined
</del>
<ins class="diff-chg">create
an
</ins><a href="#dfn-rdf-dataset" title="rdf-dataset" class="tref internalDFN"><ins class="diff-chg">
RDF
dataset
</ins></a>.<ins class="diff-chg">
Each
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-chg">
node
object
</ins></a>
in
<del class="diff-old">[
</del>
<ins class="diff-chg">the
</ins><i><ins class="diff-chg">
node
map
</ins></i><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member
which
corresponds
to
the
</ins><a href="#dfn-rdf-subject" title="rdf-subject" class="tref internalDFN"><ins class="diff-chg">
RDF
subject
</ins></a>,<ins class="diff-chg">
the
other
members
represent
</ins><a href="#dfn-rdf-predicate" title="rdf-predicate" class="tref internalDFN"><ins class="diff-chg">
RDF
predicates
</ins></a>.<ins class="diff-chg">
Each
member
value
is
either
an
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN">
<del class="diff-old">JSON-LD
</del>
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
<del class="diff-old">].
This
removes
any
existing
context
</del>
</a>
<ins class="diff-chg">or
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a><ins class="diff-chg">
or
can
be
transformed
</ins>
to
<del class="diff-old">allow
</del>
<ins class="diff-chg">an
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal" title="rdf-literal" class="tref externalDFN"><ins class="diff-chg">
RDF
literal
</ins></a><ins class="diff-chg">
to
generate
an
</ins><a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN"><ins class="diff-chg">
RDF
triple
</ins></a>.<a href="#dfn-list" title="list" class="tref internalDFN"><ins class="diff-chg">
Lists
</ins></a><ins class="diff-chg">
are
transformed
into
an
</ins><a href="http://www.w3.org/TR/rdf-schema/#ch_collectionvocab" title="rdf-collection" class="tref externalDFN"><ins class="diff-chg">
RDF
Collection
</ins></a><ins class="diff-chg">
using
</ins>
the
<del class="diff-old">given
context
</del>
<a href="#list-to-rdf-conversion">
<ins class="diff-chg">List
</ins>
to
<del class="diff-old">be
cleanly
applied.
</del>
<ins class="diff-chg">RDF
Conversion
algorithm.
</ins></a></p></section><section><h4 id="algorithm-13"><ins class="diff-chg">
Algorithm
</ins></h4><p><ins class="diff-chg">
The
algorithm
takes
a
JSON-LD
document
</ins><i><ins class="diff-chg">
element
</ins></i><ins class="diff-chg">
and
returns
an
</ins><a href="#dfn-rdf-dataset" title="rdf-dataset" class="tref internalDFN"><ins class="diff-chg">
RDF
dataset
</ins></a>.
</p>
<ol class="algorithm">
<del class="diff-old">If
</del>
<li>
<ins class="diff-chg">Expand
</ins><i>
element
<del class="diff-old">is
</del>
</i>
<ins class="diff-chg">according
the
</ins><a href="#expansion-algorithm"><ins class="diff-chg">
Expansion
algorithm
</ins></a>.</li><li><ins class="diff-chg">
Generate
</ins>
a
<del class="diff-old">JSON
object
,
perform
</del>
<i>
<ins class="diff-chg">node
map
</ins></i><ins class="diff-chg">
according
</ins>
the
<del class="diff-old">following
steps:
</del>
<a href="#node-map-generation">
<ins class="diff-chg">Node
Map
Generation
algorithm
</ins></a>.</li>
<li>
<del class="diff-old">Set
active
object
</del>
<ins class="diff-chg">Initialize
an
empty
</ins><a href="#dfn-rdf-dataset" title="rdf-dataset" class="tref internalDFN"><ins class="diff-chg">
RDF
dataset
</ins>
</a>
<del class="diff-old">to
null
</del>
<i>
<ins class="diff-chg">dataset
</ins></i>.</li><li><ins class="diff-chg">
For
each
</ins><i><ins class="diff-chg">
graph
name
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
graph
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
node
map
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
triples
</ins></i><ins class="diff-chg">
as
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>.
</li>
<li>
<del class="diff-old">If
element
has
a
@value
property:
</del>
<ins class="diff-chg">For
each
</ins><i><ins class="diff-chg">
subject
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
node
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
graph
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
For
each
</ins><i><ins class="diff-chg">
property
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
values
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
node
</ins></i>:
<ol class="algorithm">
<li>
If
<del class="diff-old">the
value
of
@value
</del>
<i>
<ins class="diff-chg">property
</ins></i>
is
<code>
<ins class="diff-new">@type
</ins></code>,<ins class="diff-new">
then
for
each
</ins><i><ins class="diff-new">
type
</ins></i><ins class="diff-new">
in
</ins><i><ins class="diff-new">
values
</ins></i>,<ins class="diff-new">
append
</ins>
a
<del class="diff-old">number
,
set
the
active
object
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref internalDFN">
<ins class="diff-chg">triple
</ins>
</a>
<ins class="diff-new">composed
of
</ins><i><ins class="diff-new">
subject
</ins></i>,<code><ins class="diff-new">
rdf:type
</ins></code>,<ins class="diff-new">
and
</ins><i><ins class="diff-new">
type
</ins></i>
to
<i>
<ins class="diff-new">triples
</ins></i>.</li><li><ins class="diff-new">
Otherwise,
if
</ins><i><ins class="diff-new">
property
</ins></i><ins class="diff-new">
is
</ins>
a
<del class="diff-old">typed
value
using
a
canonical
lexical
form
</del>
<a href="#dfn-keyword" title="keyword" class="tref internalDFN">
<ins class="diff-chg">keyword
</ins>
</a>
<del class="diff-old">of
the
value
as
defined
in
the
section
Data
Round
Tripping
.
Set
datatype
</del>
<ins class="diff-chg">continue
</ins>
to
the
<del class="diff-old">value
of
the
@type
</del>
<ins class="diff-chg">next
</ins><i>
property
<del class="diff-old">if
it
exists,
otherwise
either
xsd:integer
or
xsd:double
,
depending
on
if
the
value
contains
a
fractional
and/or
an
exponential
component.
</del>
</i>
<ins class="diff-chg">-
</ins><i><ins class="diff-chg">
values
</ins></i><ins class="diff-chg">
pair.
</ins>
</li>
<li>
Otherwise,
<del class="diff-old">if
the
value
of
@value
</del>
<i>
<ins class="diff-chg">property
</ins></i>
is
<del class="diff-old">true
</del>
<ins class="diff-chg">an
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>
or
<del class="diff-old">false
,
set
the
active
</del>
<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
<ins class="diff-chg">blank
node
identifier
</ins></a>.<ins class="diff-chg">
For
each
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
in
</ins><i><ins class="diff-chg">
values
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
is
a
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-chg">
list
</ins>
object
</a>,
<ins class="diff-new">initialize
</ins><i><ins class="diff-new">
list
triples
</ins></i><ins class="diff-new">
as
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins>
</a>
<ins class="diff-new">and
</ins><i><ins class="diff-new">
list
head
</ins></i>
to
<del class="diff-old">a
typed
value
created
from
</del>
the
<del class="diff-old">canonical
lexical
form
</del>
<ins class="diff-chg">result
</ins>
of
the
<del class="diff-old">value.
Set
datatype
to
</del>
<a href="#list-to-rdf-conversion">
<ins class="diff-chg">List
Conversion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins>
the
value
<del class="diff-old">of
</del>
<ins class="diff-chg">associated
with
</ins>
the
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">@list
</ins>
</code>
<del class="diff-old">property
if
it
exists,
otherwise
xsd:boolean
.
Otherwise,
if
element
contains
</del>
<ins class="diff-chg">key
from
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
list
triples
</ins></i>.<ins class="diff-chg">
Append
first
</ins>
a
<del class="diff-old">@type
property,
set
the
active
object
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref internalDFN">
<ins class="diff-chg">triple
</ins>
</a>
<ins class="diff-new">composed
of
</ins><i><ins class="diff-new">
subject
</ins></i>,<i><ins class="diff-new">
property
</ins></i>,<ins class="diff-new">
and
</ins><i><ins class="diff-new">
list
head
</ins></i>
to
<del class="diff-old">a
typed
value
.
</del>
<i>
<ins class="diff-chg">triples
</ins></i><ins class="diff-chg">
and
finally
append
all
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref internalDFN"><ins class="diff-chg">
triples
</ins></a><ins class="diff-chg">
from
</ins><i><ins class="diff-chg">
list
triples
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
triples
</ins></i>.
</li>
<li>
Otherwise,
<del class="diff-old">if
element
contains
</del>
<i>
<ins class="diff-chg">item
</ins></i><ins class="diff-chg">
is
</ins>
a
<del class="diff-old">@language
property,
set
the
active
</del>
<a href="#dfn-value-object" title="value-object" class="tref internalDFN">
<ins class="diff-chg">value
</ins>
object
</a>
<del class="diff-old">to
</del>
<ins class="diff-chg">or
</ins>
a
<del class="diff-old">language-tagged
string
.
Otherwise,
set
the
active
</del>
<a href="#dfn-node-object" title="node-object" class="tref internalDFN">
<ins class="diff-chg">node
</ins>
object
<del class="diff-old">to
</del>
</a>.
<ins class="diff-chg">Append
</ins>
a
<del class="diff-old">typed
value
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref internalDFN">
<ins class="diff-chg">triple
</ins>
</a>
<ins class="diff-new">composed
of
</ins><i><ins class="diff-new">
subject
</ins></i>,<i><ins class="diff-new">
property
</ins></i>,<ins class="diff-new">
and
the
result
of
</ins>
using
<del class="diff-old">xsd:string
as
</del>
the
<del class="diff-old">datatype.
</del>
<a href="#object-to-rdf-conversion">
<ins class="diff-chg">Object
to
RDF
Conversion
algorithm
</ins></a><ins class="diff-chg">
passing
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
triples
</ins></i>.</li></ol></li></ol>
</li>
</ol>
</li>
<li>
If
<del class="diff-old">element
has
a
</del>
<i>
<ins class="diff-chg">graph
name
</ins></i><ins class="diff-chg">
is
</ins>
<code>
<del class="diff-old">@list
property
the
value
must
be
an
array
.
Process
its
value
as
a
list
as
described
in
List
Conversion
using
the
return
value
as
</del>
<ins class="diff-chg">@default
</ins></code>,<ins class="diff-chg">
add
</ins><i><ins class="diff-chg">
triples
</ins></i><ins class="diff-chg">
to
</ins>
the
<del class="diff-old">active
object
</del>
<a href="#dfn-default-graph" title="default-graph" class="tref internalDFN">
<ins class="diff-chg">default
graph
</ins>
</a>
<ins class="diff-new">in
</ins><i><ins class="diff-new">
dataset
</ins></i>.
</li>
<li>
<del class="diff-old">If
active
object
is
not
null
:
If
neither
active
subject
nor
active
property
are
null
,
generate
</del>
<ins class="diff-chg">Otherwise,
create
</ins>
a
<del class="diff-old">Quad
</del>
<a href="#dfn-named-graph" title="named-graph" class="tref internalDFN">
<ins class="diff-chg">named
graph
</ins>
</a>
<del class="diff-old">representing
active
subject
,
active
property
,
active
object
,
and
</del>
<ins class="diff-chg">in
</ins><i><ins class="diff-chg">
dataset
</ins></i><ins class="diff-chg">
composed
of
</ins><i>
graph
name
<del class="diff-old">.
</del>
</i>
<ins class="diff-chg">and
add
</ins><i><ins class="diff-chg">
triples
</ins></i>.</li></ol>
</li>
<li>
Return
<del class="diff-old">active
object
.
</del>
<i>
<ins class="diff-chg">dataset
</ins></i>.
</li>
</ol>
<del class="diff-old">If
element
has
</del>
</section>
</section>
<section id="object-to-rdf-conversion">
<h3>
<span class="secno">
<ins class="diff-chg">10.2
</ins></span><ins class="diff-chg">
Object
to
RDF
Conversion
</ins></h3><p><ins class="diff-chg">
This
algorithm
takes
</ins>
a
<del class="diff-old">@id
property,
the
</del>
<a href="#dfn-node-object" title="node-object" class="tref internalDFN">
<ins class="diff-chg">node
object
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN">
value
<del class="diff-old">must
be
a
string
,
set
the
active
subject
</del>
<ins class="diff-chg">object
</ins></a><ins class="diff-chg">
and
transforms
it
into
an
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-resource" title="rdf-resource" class="tref externalDFN"><ins class="diff-chg">
RDF
resource
</ins>
</a>
to
<ins class="diff-new">be
used
as
</ins>
the
<del class="diff-old">previously
expanded
value
(either
a
blank
node
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-object" title="object" class="tref internalDFN">
<ins class="diff-chg">object
</ins>
</a>
<del class="diff-old">or
</del>
<ins class="diff-chg">of
</ins>
an
<a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN">
<ins class="diff-chg">RDF
triple
</ins></a>.</p><section class="informative"><h4 id="general-solution-14"><ins class="diff-chg">
General
Solution
</ins></h4>
<del class="diff-old">IRI
</del>
<p>
<del class="diff-old">).
Otherwise,
if
</del>
<em>
<del class="diff-old">element
</del>
<ins class="diff-chg">This
section
is
non-normative.
</ins>
</em>
<del class="diff-old">does
not
have
a
@id
property,
set
</del>
</p>
<p>
<a href="#dfn-value-object" title="value-object" class="tref internalDFN">
<ins class="diff-chg">Value
objects
</ins></a><ins class="diff-chg">
are
transformed
to
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal" title="rdf-literal" class="tref internalDFN"><ins class="diff-chg">
RDF
literals
</ins></a><ins class="diff-chg">
as
defined
in
</ins>
the
<del class="diff-old">active
subject
</del>
<ins class="diff-chg">section
</ins><a href="#data-round-tripping"><ins class="diff-chg">
Data
Round
Tripping
</ins>
</a>
<ins class="diff-new">whereas
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-new">
node
objects
</ins></a><ins class="diff-new">
are
transformed
</ins>
to
<del class="diff-old">newly
generated
</del>
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<ins class="diff-chg">IRIs
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
<ins class="diff-new">identifiers
</ins>
</a>.
<del class="diff-old">Process
each
property
and
value
in
element
,
ordered
by
property
,
</del>
</p>
</section>
<section>
<h4 id="algorithm-14">
<ins class="diff-chg">Algorithm
</ins></h4><p><ins class="diff-chg">
The
algorithm
takes
</ins>
as
<del class="diff-old">follows:
</del>
<ins class="diff-chg">its
sole
argument
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
which
must
be
either
a
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN"><ins class="diff-chg">
value
object
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-chg">
node
object
</ins></a>.</p>
<ol class="algorithm">
<li>
If
<del class="diff-old">property
</del>
<i>
<ins class="diff-chg">item
</ins></i>
is
<del class="diff-old">@type
,
set
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-chg">
node
object
</ins></a><ins class="diff-chg">
return
</ins>
the
<del class="diff-old">active
property
</del>
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
<ins class="diff-chg">IRI
</ins></abbr>
</a>
<del class="diff-old">to
</del>
<ins class="diff-chg">or
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a><ins class="diff-chg">
associated
with
its
</ins>
<code>
<del class="diff-old">rdf:type
.
</del>
<ins class="diff-chg">@id
</ins></code><ins class="diff-chg">
member.
</ins>
</li>
<li>
Otherwise,
<del class="diff-old">if
property
</del>
<i>
<ins class="diff-chg">item
</ins></i>
is
<del class="diff-old">@graph
,
process
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN">
value
<del class="diff-old">algorithm
recursively,
using
active
subject
as
graph
name
and
null
values
for
active
subject
and
active
property
and
then
proceed
</del>
<ins class="diff-chg">object
</ins></a>.<ins class="diff-chg">
Initialize
</ins><i><ins class="diff-chg">
value
</ins></i>
to
<del class="diff-old">next
property.
Otherwise,
if
property
is
a
keyword
,
skip
this
step.
</del>
<ins class="diff-chg">the
value
associated
with
the
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member
in
</ins><i><ins class="diff-chg">
item
</ins></i>.
</li>
<li>
<del class="diff-old">Otherwise,
set
active
property
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
datatype
</ins></i>
to
the
<del class="diff-old">expanded
IRI
form
</del>
<ins class="diff-chg">value
associated
with
the
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
</ins>
of
<del class="diff-old">property
.
</del>
<i>
<ins class="diff-chg">item
</ins></i><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
null
</ins></code><ins class="diff-chg">
if
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
does
not
have
such
a
member.
</ins>
</li>
<li>
<del class="diff-old">Process
</del>
<ins class="diff-chg">If
</ins><i>
value
<del class="diff-old">recursively
using
this
algorithm,
passing
copies
of
active
subject
</del>
</i>
<ins class="diff-chg">is
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-false" title="false" class="tref internalDFN"><ins class="diff-chg">
false
</ins>
</a>,
<del class="diff-old">active
property
</del>
<ins class="diff-chg">set
</ins><i><ins class="diff-chg">
value
</ins></i><ins class="diff-chg">
to
its
</ins><a href="#dfn-canonical-lexical-form" title="canonical-lexical-form" class="tref internalDFN"><ins class="diff-chg">
canonical
lexical
form
</ins>
</a>
<del class="diff-old">and
graph
name
</del>
<ins class="diff-chg">as
defined
in
the
section
</ins><a href="#data-round-tripping"><ins class="diff-chg">
Data
Round
Tripping
</ins>
</a>.
<del class="diff-old">Set
active
object
</del>
<ins class="diff-chg">If
</ins><i><ins class="diff-chg">
datatype
</ins></i><ins class="diff-chg">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>,<ins class="diff-chg">
set
it
</ins>
to
<del class="diff-old">active
subject
.
</del>
<code>
<ins class="diff-chg">xsd:boolean
</ins></code>.
</li>
<li>
Otherwise,
if
<del class="diff-old">element
</del>
<i>
<ins class="diff-chg">value
</ins></i>
is
<del class="diff-old">an
array
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-number" title="number" class="tref internalDFN"><ins class="diff-chg">
number
</ins>
</a>,
<del class="diff-old">process
each
</del>
<ins class="diff-chg">then
set
</ins><i>
value
<del class="diff-old">in
the
array
</del>
</i>
<ins class="diff-chg">to
its
</ins><a href="#dfn-canonical-lexical-form" title="canonical-lexical-form" class="tref internalDFN"><ins class="diff-chg">
canonical
lexical
form
</ins>
</a>
as
<del class="diff-old">follows,
process
element
recursively
using
this
algorithm,
using
copies
of
active
subject
,
active
property
,
and
graph
name
</del>
<ins class="diff-chg">defined
in
the
section
</ins><a href="#data-round-tripping"><ins class="diff-chg">
Data
Round
Tripping
</ins>
</a>.
<ins class="diff-new">If
</ins><i><ins class="diff-new">
datatype
</ins></i><ins class="diff-new">
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>,<ins class="diff-new">
set
it
to
either
</ins><code><ins class="diff-new">
xsd:integer
</ins></code><ins class="diff-new">
or
</ins><code><ins class="diff-new">
xsd:double
</ins></code>,<ins class="diff-new">
depending
on
if
the
value
contains
a
fractional
and/or
an
exponential
component.
</ins>
</li>
<li>
Otherwise,
if
<del class="diff-old">element
</del>
<i>
<ins class="diff-chg">datatype
</ins></i>
is
<del class="diff-old">a
string
</del>
<a href="#dfn-null" title="null" class="tref internalDFN">
<ins class="diff-chg">null
</ins>
</a>,
<del class="diff-old">then
the
active
property
must
be
rdf:type
so
</del>
set
<del class="diff-old">the
active
object
</del>
<ins class="diff-chg">it
</ins>
to
<code>
<ins class="diff-new">xsd:string
</ins></code><ins class="diff-new">
or
</ins><code><ins class="diff-new">
rdf:langString
</ins></code>,<ins class="diff-new">
depending
on
if
item
has
</ins>
an
<del class="diff-old">IRI
.
</del>
<code>
<ins class="diff-chg">@language
</ins></code><ins class="diff-chg">
member.
</ins>
</li>
<li>
<del class="diff-old">If
any
of
these
steps
created
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
literal
</ins></i><ins class="diff-chg">
as
</ins>
an
<del class="diff-old">active
object
and
neither
active
subject
nor
active
property
are
null
,
generate
a
Quad
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal" title="rdf-literal" class="tref internalDFN">
<ins class="diff-chg">RDF
literal
</ins>
</a>
using
<del class="diff-old">active
subject
,
active
property
,
active
object
</del>
<i>
<ins class="diff-chg">value
</ins></i>
and
<del class="diff-old">graph
name
.
</del>
<i>
<ins class="diff-chg">datatype
</ins></i>.<ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
has
an
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
member
and
</ins><i><ins class="diff-chg">
datatype
</ins></i><ins class="diff-chg">
is
</ins><code><ins class="diff-chg">
rdf:langString
</ins></code>,<ins class="diff-chg">
then
add
the
value
associated
with
the
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
key
as
the
language
of
</ins><i><ins class="diff-chg">
literal
</ins></i>.
</li>
<li>
Return
<del class="diff-old">active
object
.
</del>
<i>
<ins class="diff-chg">literal
</ins></i>.
</li>
</ol>
</section>
</section>
<section id="list-to-rdf-conversion">
<h3>
<span class="secno">
<del class="diff-old">5.16.2
</del>
<ins class="diff-chg">10.3
</ins>
</span>
List
<ins class="diff-new">to
RDF
</ins>
Conversion
</h3>
<p>
List
Conversion
is
the
process
of
taking
<del class="diff-old">an
array
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-chg">
list
object
</ins>
</a>
<del class="diff-old">of
values
</del>
and
<del class="diff-old">adding
them
to
a
newly
created
</del>
<ins class="diff-chg">transforming
it
into
an
</ins><a href="http://www.w3.org/TR/rdf-schema/#ch_collectionvocab" title="rdf-collection" class="tref externalDFN">
RDF
Collection
</a>
<del class="diff-old">(see
</del>
<ins class="diff-chg">as
defined
in
RDF
Semantics
</ins>
[
<cite>
<del class="diff-old">RDF-SCHEMA
</del>
<a href="#bib-RDF-MT" class="bibref">
<ins class="diff-chg">RDF-MT
</ins>
</a>
</cite>
<del class="diff-old">])
by
linking
</del>
<ins class="diff-chg">].
</ins></p><section class="informative"><h4 id="general-solution-15"><ins class="diff-chg">
General
Solution
</ins></h4><p><em><ins class="diff-chg">
This
section
is
non-normative.
</ins></em></p><p><ins class="diff-chg">
For
</ins>
each
element
of
the
<a href="#dfn-list" title="list" class="tref internalDFN">
list
<del class="diff-old">using
</del>
</a>
<ins class="diff-chg">a
new
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a><ins class="diff-chg">
is
allocated
which
is
used
to
generate
</ins>
<code>
rdf:first
</code>
and
<code>
<del class="diff-old">rdf:next
,
terminating
</del>
<ins class="diff-chg">rdf:rest
</ins></code><a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN"><ins class="diff-chg">
triples
</ins></a>.<ins class="diff-chg">
The
algorithm
returns
</ins>
the
list
<del class="diff-old">with
</del>
<ins class="diff-chg">head,
which
is
either
the
the
first
allocated
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins></a><ins class="diff-chg">
or
</ins>
<code>
rdf:nil
</code>
<del class="diff-old">using
</del>
<ins class="diff-chg">if
</ins>
the
<del class="diff-old">following
sequence:
</del>
<a href="#dfn-list" title="list" class="tref internalDFN">
<ins class="diff-chg">list
</ins></a><ins class="diff-chg">
is
empty.
</ins>
</p>
</section>
<section>
<h4 id="algorithm-15">
<ins class="diff-new">Algorithm
</ins></h4>
<p>
The
algorithm
<del class="diff-old">is
invoked
with
</del>
<ins class="diff-chg">takes
two
inputs:
</ins>
an
<del class="diff-old">array
</del>
<a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">,
the
active
property
</del>
</a>
<i>
<ins class="diff-new">list
</ins></i>
and
<del class="diff-old">returns
a
value
to
be
used
as
</del>
an
<del class="diff-old">active
object
</del>
<ins class="diff-chg">empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">in
</del>
<i>
<ins class="diff-chg">list
triples
</ins></i><ins class="diff-chg">
used
for
returning
</ins>
the
<del class="diff-old">calling
location.
Note
This
algorithm
does
not
support
lists
containing
lists.
Issue
This
algorithm
hasn't
been
updated
yet.
</del>
<ins class="diff-chg">generated
</ins><a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN"><ins class="diff-chg">
triples
</ins></a>.
</p>
<ol class="algorithm">
<li>
If
<del class="diff-old">array
</del>
<i>
<ins class="diff-chg">list
</ins></i>
is
<del class="diff-old">empty
</del>
<ins class="diff-chg">empty,
</ins>
return
<code>
rdf:nil
</code>.
</li>
<li>
Otherwise,
<del class="diff-old">generate
a
Quad
using
using
the
active
subject
,
active
property
</del>
<ins class="diff-chg">create
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">and
</del>
<i>
<ins class="diff-chg">bnodes
</ins></i><ins class="diff-chg">
composed
of
</ins>
a
<a href="#generate-blank-node-identifier">
newly
generated
blank
node
<ins class="diff-new">identifier
</ins>
</a>
<del class="diff-old">identified
as
first
blank
node
</del>
<ins class="diff-chg">for
each
entry
in
</ins><i><ins class="diff-chg">
list
</ins></i>.</li><li><ins class="diff-chg">
Initialize
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">.
</del>
<i>
<ins class="diff-chg">list
triples
</ins></i>.
</li>
<li>
For
each
<del class="diff-old">element
in
array
other
than
the
last
element:
</del>
<ins class="diff-chg">pair
of
</ins><i><ins class="diff-chg">
subject
</ins></i><ins class="diff-chg">
from
</ins><i><ins class="diff-chg">
bnodes
</ins></i><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
from
</ins><i><ins class="diff-chg">
list
</ins></i>:
<ol class="algorithm">
<li>
<del class="diff-old">Create
</del>
<ins class="diff-chg">Append
</ins>
a
<del class="diff-old">processor
state
using
first
blank
node
as
the
active
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref internalDFN">
<ins class="diff-chg">triple
</ins></a><ins class="diff-chg">
composed
of
</ins><i>
subject
<del class="diff-old">,
and
</del>
</i>,
<code>
rdf:first
<del class="diff-old">as
the
active
property
.
Process
</del>
</code>,
<ins class="diff-chg">and
</ins>
the
<del class="diff-old">value
starting
at
Step
1
.
Proceed
</del>
<ins class="diff-chg">result
of
</ins>
using
<del class="diff-old">the
previous
processor
state
.
</del>
<ins class="diff-chg">th
</ins><a href="#object-to-rdf-conversion"><ins class="diff-chg">
Object
to
RDF
Conversion
algorithm
</ins></a><ins class="diff-chg">
passing
</ins><i><ins class="diff-chg">
item
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
list
triples
</ins></i>.
</li>
<li>
<del class="diff-old">Unless
this
is
</del>
<ins class="diff-chg">Set
</ins><i><ins class="diff-chg">
rest
</ins></i><ins class="diff-chg">
as
</ins>
the
<del class="diff-old">last
element
</del>
<ins class="diff-chg">next
entry
</ins>
in
<del class="diff-old">array
,
generate
a
new
blank
node
identified
as
rest
blank
node
,
otherwise
use
</del>
<i>
<ins class="diff-chg">bnodes
</ins></i>,<ins class="diff-chg">
or
if
that
does
not
exist,
</ins>
<code>
rdf:nil
</code>.
<del class="diff-old">Generate
</del>
<ins class="diff-chg">Append
</ins>
a
<del class="diff-old">new
Quad
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref internalDFN">
<ins class="diff-chg">triple
</ins>
</a>
<del class="diff-old">using
first
blank
node
,
</del>
<ins class="diff-chg">composed
of
</ins><i><ins class="diff-chg">
subject
</ins></i>,
<code>
rdf:rest
</code>,
and
<i>
rest
<del class="diff-old">blank
node
.
Set
first
blank
node
</del>
</i>
to
<del class="diff-old">rest
blank
node
.
</del>
<i>
<ins class="diff-chg">list
triples
</ins></i>.</li></ol>
</li>
<li>
Return
<ins class="diff-chg">the
</ins>
first
<a href="#dfn-blank-node" title="blank-node" class="tref internalDFN">
blank
node
<del class="diff-old">.
</del>
</a>
<ins class="diff-chg">from
</ins><i><ins class="diff-chg">
bnodes
</ins></i><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
rdf:nil
</ins></code><ins class="diff-chg">
if
</ins><i><ins class="diff-chg">
bnodes
</ins></i><ins class="diff-chg">
is
empty.
</ins>
</li>
</ol>
</section>
</section>
<section id="convert-from-rdf-algorithm">
<h3>
<span class="secno">
<del class="diff-old">5.16.3
</del>
<ins class="diff-chg">10.4
</ins>
</span>
Convert
from
RDF
Algorithm
</h3>
<p>
<ins class="diff-chg">This
algorithm
converts
an
</ins><a href="#dfn-rdf-dataset" title="rdf-dataset" class="tref internalDFN"><ins class="diff-chg">
RDF
dataset
</ins></a><ins class="diff-chg">
consisting
of
a
</ins><a href="#dfn-default-graph" title="default-graph" class="tref internalDFN"><ins class="diff-chg">
default
graph
</ins></a><ins class="diff-chg">
and
zero
or
more
</ins><a href="#dfn-named-graph" title="named-graph" class="tref internalDFN"><ins class="diff-chg">
named
graphs
</ins></a><ins class="diff-chg">
into
a
JSON-LD
document.
</ins></p>
<p>
In
some
cases,
data
exists
natively
in
the
form
of
triples
or
<del class="diff-old">or
quads
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref internalDFN">
<ins class="diff-chg">triples
</ins>
</a>
;
for
example,
if
the
data
was
originally
represented
in
an
<a href="#dfn-rdf-dataset" title="rdf-dataset" class="tref internalDFN">
RDF
<del class="diff-old">graph
or
triple/quad
store.
</del>
<ins class="diff-chg">dataset
</ins></a>.
This
algorithm
is
designed
to
simply
translate
an
array
of
<del class="diff-old">quads
</del>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" title="triple" class="tref internalDFN">
<ins class="diff-chg">triples
</ins>
</a>
into
a
JSON-LD
document.
</p>
<div class="note">
<div class="note-title">
<span>
<ins class="diff-new">Note
</ins></span></div><p class=""><ins class="diff-new">
This
algorithm
does
not
support
lists
containing
lists.
</ins></p></div><section class="informative"><h4 id="general-solution-16"><ins class="diff-new">
General
Solution
</ins></h4>
<p>
<del class="diff-old">When
expanding
typed
values
</del>
<em>
<ins class="diff-chg">This
section
is
non-normative.
</ins></em></p><p><ins class="diff-chg">
Iterate
through
each
graph
in
the
dataset,
converting
</ins><a href="http://www.w3.org/TR/rdf-schema/#ch_collectionvocab" title="rdf-collection" class="tref internalDFN"><ins class="diff-chg">
RDF
Collections
</ins>
</a>
<del class="diff-old">having
</del>
<ins class="diff-chg">into
</ins>
a
<del class="diff-old">datatype
of
xsd:string
,
the
@type
must
not
be
set
to
xsd:string
</del>
<a href="#dfn-list" title="list" class="tref internalDFN">
<ins class="diff-chg">list
</ins></a>
and
<del class="diff-old">the
resulting
value
must
have
only
</del>
<ins class="diff-chg">generating
</ins>
a
<del class="diff-old">@value
property.
</del>
<ins class="diff-chg">JSON-LD
document
in
expanded
form
for
all
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal" title="rdf-literal" class="tref internalDFN"><ins class="diff-chg">
RDF
literals
</ins></a>,<a href="#dfn-iri" title="iri" class="tref internalDFN"><ins class="diff-chg">
IRIs
</ins></a><ins class="diff-chg">
and
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifiers
</ins></a>.
</p>
</section>
<section>
<h4 id="algorithm-16">
<ins class="diff-new">Algorithm
</ins></h4>
<p>
The
<del class="diff-old">conversion
</del>
algorithm
takes
a
single
parameter
<del class="diff-old">input
</del>
<i>
<ins class="diff-chg">dataset
</ins></i>
in
the
form
of
an
array
of
<del class="diff-old">Quad
representations.
Issue
This
algorithm
hasn't
been
updated
yet.
</del>
<ins class="diff-chg">an
</ins><a href="#dfn-rdf-dataset" title="rdf-dataset" class="tref internalDFN"><ins class="diff-chg">
RDF
dataset
</ins></a>.
</p>
<ol class="algorithm">
<del class="diff-old">Construct
defaultGraph
as
</del>
<li>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
default
graph
</ins></i><ins class="diff-chg">
to
</ins>
a
<ins class="diff-chg">new
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<del class="diff-old">containing
nodes
</del>
<ins class="diff-chg">consisting
of
two
members,
</ins><code><ins class="diff-chg">
nodeMap
</ins></code>
and
<code>
listMap
<del class="diff-old">,
each
</del>
</code>,
<ins class="diff-chg">whose
value
is
an
</ins>
an
empty
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>.
</li>
<li>
<del class="diff-old">Construct
graphs
as
a
</del>
<ins class="diff-chg">Initialize
</ins><i><ins class="diff-chg">
graph
map
</ins></i><ins class="diff-chg">
to
an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<del class="diff-old">containing
defaultGraph
identified
by
an
empty
string
.
</del>
<ins class="diff-chg">consisting
of
a
single
member
</ins><code><ins class="diff-chg">
@default
</ins></code><ins class="diff-chg">
whose
value
is
set
to
reference
</ins><i><ins class="diff-chg">
default
graph
</ins></i>.</li><li><ins class="diff-chg">
Reference
the
</ins><code><ins class="diff-chg">
nodeMap
</ins></code><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
default
graph
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
default
graph
nodes
</ins></i>.
</li>
<li>
For
each
<del class="diff-old">quad
</del>
<i>
<ins class="diff-chg">graph
</ins></i>
in
<del class="diff-old">input
:
</del>
<i>
<ins class="diff-chg">dataset
</ins></i>:
<ol class="algorithm">
<li>
<del class="diff-old">Set
</del>
<ins class="diff-chg">If
</ins><i>
graph
</i>
<ins class="diff-chg">is
the
</ins><a href="#dfn-default-graph" title="default-graph" class="tref internalDFN"><ins class="diff-chg">
default
graph
</ins></a>,<ins class="diff-chg">
set
</ins><i><ins class="diff-chg">
name
</ins></i><ins class="diff-chg">
to
</ins><code><ins class="diff-chg">
@default
</ins></code>,<ins class="diff-chg">
otherwise
</ins>
to
the
<del class="diff-old">entry
in
graphs
identified
by
</del>
<a href="#dfn-graph-name" title="graph-name" class="tref internalDFN">
<ins class="diff-chg">graph
</ins>
name
<del class="diff-old">,
initializing
it
</del>
</a>
<ins class="diff-chg">associated
with
</ins><i><ins class="diff-chg">
graph
</ins></i>.</li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
graph
map
</ins></i><ins class="diff-chg">
has
no
</ins><i><ins class="diff-chg">
name
</ins></i><ins class="diff-chg">
member,
create
one
and
set
its
value
to
a
</ins>
to
a
new
<del class="diff-old">entry
using
the
mechanism
described
in
Step
1
</del>
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
<ins class="diff-chg">JSON
object
</ins></a><ins class="diff-chg">
consisting
of
two
members,
</ins><code><ins class="diff-chg">
nodeMap
</ins></code><ins class="diff-chg">
and
</ins><code><ins class="diff-chg">
listMap
</ins></code>,<ins class="diff-chg">
whose
value
is
an
an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins>
</a>.
</li>
<li>
If
<del class="diff-old">property
</del>
<i>
<ins class="diff-chg">graph
</ins></i>
is
<del class="diff-old">rdf:first
,
use
</del>
<ins class="diff-chg">not
</ins>
the
<del class="diff-old">entry
in
graph.listMap
indexed
by
subject
,
initializing
it
</del>
<a href="#dfn-default-graph" title="default-graph" class="tref internalDFN">
<ins class="diff-chg">default
graph
</ins></a><ins class="diff-chg">
and
</ins><i><ins class="diff-chg">
default
graph
nodes
</ins></i><ins class="diff-chg">
does
not
have
a
</ins><i><ins class="diff-chg">
name
</ins></i><ins class="diff-chg">
member,
create
such
a
member
and
initialize
its
value
</ins>
to
a
new
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<del class="diff-old">if
nesessary.
Represent
object
in
expanded
form
,
as
described
</del>
<ins class="diff-chg">with
a
single
member
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
whose
value
is
</ins><i><ins class="diff-chg">
name
</ins></i>.</li><li><ins class="diff-chg">
Reference
the
value
of
the
</ins><i><ins class="diff-chg">
name
</ins></i><ins class="diff-chg">
member
</ins>
in
<del class="diff-old">Value
Expansion
.
Add
</del>
<i>
<ins class="diff-chg">graph
map
</ins></i><ins class="diff-chg">
using
</ins>
the
<del class="diff-old">resulting
</del>
<ins class="diff-chg">variable
</ins><i><ins class="diff-chg">
graph
</ins>
object
<del class="diff-old">representation
to
</del>
</i>.
</li>
<li>
<ins class="diff-chg">Reference
</ins>
the
<del class="diff-old">entry
indexed
by
first
,
</del>
<ins class="diff-chg">value
of
the
</ins><code><ins class="diff-chg">
nodeMap
</ins></code><ins class="diff-chg">
member
in
</ins><i><ins class="diff-chg">
graph
object
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
node
map
</ins></i>
and
<del class="diff-old">skip
to
</del>
the
<del class="diff-old">next
quad
.
</del>
<ins class="diff-chg">value
of
the
</ins><code><ins class="diff-chg">
listMap
</ins></code><ins class="diff-chg">
member
using
the
variable
</ins><i><ins class="diff-chg">
list
map
</ins></i>.
</li>
<li>
<ins class="diff-new">For
each
</ins><a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN"><ins class="diff-new">
RDF
triple
</ins></a><ins class="diff-new">
in
</ins><i><ins class="diff-new">
graph
</ins></i><ins class="diff-new">
consisting
of
</ins><i><ins class="diff-new">
subject
</ins></i>,<i><ins class="diff-new">
predicate
</ins></i>,<ins class="diff-new">
and
</ins><i><ins class="diff-new">
object
</ins></i>:<ol class="algorithm"><li>
If
<del class="diff-old">property
is
</del>
<i>
<ins class="diff-chg">predicate
</ins></i><ins class="diff-chg">
equals
</ins>
<code>
<del class="diff-old">rdf:rest
:
</del>
<ins class="diff-chg">rdf:first
</ins></code>,
<ol class="algorithm">
<li>
If
<del class="diff-old">object
is
a
blank
node
,
use
the
entry
in
graph.listMap
indexed
by
</del>
<i>
<ins class="diff-chg">list
map
</ins></i><ins class="diff-chg">
has
no
</ins><i>
subject
<del class="diff-old">,
initializing
</del>
</i>
<ins class="diff-chg">member,
create
one
and
initialize
</ins>
it
to
<del class="diff-old">a
new
</del>
<ins class="diff-chg">an
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
<del class="diff-old">if
necessary.
Add
</del>
</a>.
</li>
<li>
<ins class="diff-chg">Initialize
</ins>
the
<del class="diff-old">nominalValue
</del>
<ins class="diff-chg">value
</ins>
of
<del class="diff-old">object
</del>
<ins class="diff-chg">the
</ins><code><ins class="diff-chg">
first
</ins></code><ins class="diff-chg">
member
of
the
</ins><i><ins class="diff-chg">
subject
</ins></i><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
list
map
</ins></i>
to
the
<del class="diff-old">entry
indexed
by
rest
.
</del>
<ins class="diff-chg">result
of
the
</ins><a href="#rdf-to-object-conversion"><ins class="diff-chg">
RDF
to
Object
Conversion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><i><ins class="diff-chg">
object
</ins></i>.
</li>
<li>
<del class="diff-old">Skip
to
</del>
<ins class="diff-chg">Continue
with
</ins>
the
next
<del class="diff-old">quad
</del>
<a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN">
<ins class="diff-chg">RDF
triple
</ins>
</a>.
</li>
</ol>
</li>
<li>
If
<del class="diff-old">name
is
not
null
,
</del>
<i>
<ins class="diff-chg">predicate
</ins></i><ins class="diff-chg">
equals
</ins><code><ins class="diff-chg">
rdf:rest
</ins></code>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
list
map
</ins></i><ins class="diff-chg">
has
no
</ins><i><ins class="diff-chg">
subject
</ins></i><ins class="diff-chg">
member,
create
one
</ins>
and
<del class="diff-old">defaultGraph.nodes
does
not
contain
</del>
<ins class="diff-chg">initialize
it
to
</ins>
an
<del class="diff-old">entry
for
name
,
create
a
new
entry
for
name
from
a
new
</del>
<ins class="diff-chg">empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
<del class="diff-old">with
key/value
pair
</del>
</a>.
</li>
<li>
<ins class="diff-chg">Initialize
the
value
</ins>
of
<ins class="diff-new">the
</ins>
<code>
<del class="diff-old">@id
</del>
<ins class="diff-chg">rest
</ins>
</code>
<del class="diff-old">and
name
represented
in
expanded
</del>
<ins class="diff-chg">member
of
the
</ins><i><ins class="diff-chg">
subject
</ins></i><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
list
map
</ins></i><ins class="diff-chg">
to
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-object" title="object" class="tref internalDFN"><ins class="diff-chg">
object
</ins></a>,<ins class="diff-chg">
which
is
either
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">form
</del>
</a>
<ins class="diff-chg">or
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-chg">
blank
node
identifier
</ins>
</a>.
</li>
<li>
<del class="diff-old">Set
value
as
</del>
<ins class="diff-chg">Continue
with
</ins>
the
<del class="diff-old">entry
from
graph.nodes
for
</del>
<ins class="diff-chg">next
</ins><a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN"><ins class="diff-chg">
RDF
triple
</ins></a>.</li></ol></li><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
node
map
</ins></i><ins class="diff-chg">
does
not
have
a
</ins><i>
subject
<del class="diff-old">,
initializing
it
</del>
</i>
<ins class="diff-chg">member,
create
one
and
initialize
its
value
</ins>
to
a
new
<a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
<del class="diff-old">with
key/value
pair
</del>
<ins class="diff-chg">consisting
</ins>
of
<ins class="diff-new">a
single
member
</ins>
<code>
@id
</code>
<del class="diff-old">and
</del>
<ins class="diff-chg">whose
value
is
set
to
</ins><i>
subject
<del class="diff-old">represented
</del>
</i>.
</li>
<li>
<ins class="diff-chg">Reference
the
value
of
the
</ins><i><ins class="diff-chg">
subject
</ins></i><ins class="diff-chg">
member
</ins>
in
<del class="diff-old">expanded
IRI
form
if
necessary.
</del>
<i>
<ins class="diff-chg">node
map
</ins></i><ins class="diff-chg">
using
the
variable
</ins><i><ins class="diff-chg">
node
</ins></i>.
</li>
<li>
If
<del class="diff-old">property
is
</del>
<i>
<ins class="diff-chg">predicate
</ins></i><ins class="diff-chg">
equals
</ins>
<code>
rdf:type
</code>,
<ins class="diff-chg">and
</ins><i>
object
</i>
is
<del class="diff-old">not
a
JSON-LD
value
,
and
the
useRdfType
</del>
<ins class="diff-chg">an
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN">
<del class="diff-old">option
is
not
present
or
false
:
Append
object
represented
in
expanded
</del>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">form
</del>
</a>
<ins class="diff-new">or
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-new">
blank
node
identifier
</ins></a>,<ins class="diff-new">
append
</ins><i><ins class="diff-new">
object
</ins></i>
to
the
<del class="diff-old">array
</del>
value
<del class="diff-old">for
</del>
<ins class="diff-chg">of
</ins>
the
<del class="diff-old">key
</del>
<code>
@type
<del class="diff-old">,
creating
an
entry
in
value
if
necessary.
Otherwise,
if
object
is
a
typed
value
and
the
useNativeTypes
</del>
</code>
<del class="diff-old">option
is
set
to
true
:
Generate
a
converted
value
:
</del>
<ins class="diff-chg">member
of
</ins><i><ins class="diff-chg">
node
</ins></i>.
If
<del class="diff-old">the
literal's
type
is
xsd:boolean
,
the
converted
value
is
true
</del>
<ins class="diff-chg">no
such
member
exists,
create
one
and
initialize
it
to
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins>
</a>
<del class="diff-old">if
the
literal
matches
the
value
true
or
false
if
the
literal
matches
the
value
false
.
If
the
literal's
type
</del>
<ins class="diff-chg">whose
only
item
</ins>
is
<del class="diff-old">xsd:integer
or
xsd:double
,
try
</del>
<i>
<ins class="diff-chg">object
</ins></i>.<ins class="diff-chg">
Finally,
continue
</ins>
to
<del class="diff-old">convert
</del>
the
<del class="diff-old">literal
to
a
JSON
number
</del>
<ins class="diff-chg">next
</ins><a href="#dfn-rdf-triple" title="rdf-triple" class="tref internalDFN"><ins class="diff-chg">
RDF
triple
</ins>
</a>.
</li>
<li>
If
<del class="diff-old">the
conversion
is
successful,
store
the
result
in
converted
value
,
otherwise
set
converted
</del>
<i>
<ins class="diff-chg">node
</ins></i><ins class="diff-chg">
does
not
have
an
</ins><i><ins class="diff-chg">
predicate
</ins></i><ins class="diff-chg">
member,
create
one
and
initialize
its
</ins>
value
to
<del class="diff-old">value
.
</del>
<ins class="diff-chg">an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.
</li>
<li>
<del class="diff-old">Otherwise,
do
not
perform
a
conversion.
</del>
Set
<del class="diff-old">the
converted
</del>
<i>
value
</i>
to
the
<del class="diff-old">value
.
</del>
<ins class="diff-chg">result
of
using
the
</ins><a href="#rdf-to-object-conversion"><ins class="diff-chg">
RDF
to
Object
Conversion
algorithm
</ins></a>,<ins class="diff-chg">
passing
</ins><i><ins class="diff-chg">
object
</ins></i>.
</li>
<li>
<del class="diff-old">Append
the
converted
</del>
<ins class="diff-chg">Add
a
reference
to
</ins><i>
value
</i>
to
the
<ins class="diff-new">to
the
</ins><a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">value
for
</del>
</a>
<ins class="diff-chg">associated
with
</ins>
the
<del class="diff-old">key,
creating
an
entry
in
value
if
necessary.
</del>
<i>
<ins class="diff-chg">predicate
</ins></i><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
node
</ins></i>.
</li>
<li>
<del class="diff-old">Otherwise,
if
</del>
<ins class="diff-chg">If
</ins><i>
object
</i>
is
<del class="diff-old">rdf:nil
:
Let
key
be
property
expressed
in
expanded
IRI
form
.
Append
an
empty
@list
representation
to
the
array
value
for
key
,
creating
</del>
an
<del class="diff-old">entry
in
value
if
necessary.
Otherwise,
Let
key
be
property
expressed
in
expanded
</del>
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
<del class="diff-old">form
and
let
object
representation
be
object
represented
in
expanded
form
</del>
</a>
<del class="diff-old">as
described
in
Value
Expansion
.
If
object
is
</del>
<ins class="diff-chg">or
</ins>
a
<a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN">
blank
node
<del class="diff-old">,
use
the
entry
in
graph.listMap
indexed
by
object
,
initializing
</del>
<ins class="diff-chg">identifier
</ins></a>
it
<del class="diff-old">to
</del>
<ins class="diff-chg">might
represent
the
head
of
</ins>
a
<del class="diff-old">new
JSON
</del>
<ins class="diff-chg">RDF
list:
</ins><ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i><ins class="diff-chg">
list
map
</ins></i><ins class="diff-chg">
has
no
</ins><i>
object
<del class="diff-old">if
nesessary.
Add
</del>
</i>
<ins class="diff-chg">member,
create
one
and
set
its
value
to
</ins>
an
<del class="diff-old">entry
for
head
with
</del>
<ins class="diff-chg">empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
</ins>
object
<del class="diff-old">representation
.
</del>
</a>.
</li>
<li>
<del class="diff-old">Append
</del>
<ins class="diff-chg">Set
the
</ins><code><ins class="diff-chg">
head
</ins></code><ins class="diff-chg">
member
of
the
</ins><i>
object
<del class="diff-old">representation
</del>
</i>
<ins class="diff-chg">member
of
</ins><i><ins class="diff-chg">
list
map
</ins></i>
to
<ins class="diff-new">a
reference
of
</ins><i><ins class="diff-new">
value
</ins></i>.<ins class="diff-new">
This
reference
may
be
required
later
to
replace
</ins>
the
<del class="diff-old">array
</del>
<i>
value
<del class="diff-old">for
key
,
creating
an
entry
</del>
</i>
in
<del class="diff-old">value
if
necessary.
</del>
<ins class="diff-chg">the
</ins><i><ins class="diff-chg">
predicate
</ins></i><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
node
</ins></i><ins class="diff-chg">
with
a
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-chg">
list
object
</ins></a>.</li></ol>
</li>
</ol>
</li>
</ol>
</li>
<li>
For
each
<i>
name
</i>
and
<i>
graph
<ins class="diff-chg">object
</ins></i>
in
<del class="diff-old">graphs
:
</del>
<i>
<ins class="diff-chg">graph
map
</ins></i>:
<ol class="algorithm">
<li>
<ins class="diff-new">Reference
the
value
of
the
</ins><code><ins class="diff-new">
listMap
</ins></code><ins class="diff-new">
member
in
</ins><i><ins class="diff-new">
graph
object
</ins></i><ins class="diff-new">
using
the
variable
</ins><i><ins class="diff-new">
list
map
</ins></i>.</li><li>
For
each
<ins class="diff-chg">key-value
pair
</ins><i>
subject
<del class="diff-old">and
</del>
</i>
<ins class="diff-chg">-
</ins><i>
entry
<del class="diff-old">in
</del>
</i>
<ins class="diff-chg">of
the
value
associated
to
the
</ins><code><ins class="diff-chg">
listMap
</ins></code><ins class="diff-chg">
member
of
</ins><i>
graph
<del class="diff-old">where
</del>
<ins class="diff-chg">object
</ins></i>:<ol class="algorithm"><li><ins class="diff-chg">
If
</ins><i>
entry
</i>
has
<del class="diff-old">both
</del>
<ins class="diff-chg">not
an
</ins><code>
head
</code>
and
<ins class="diff-chg">an
</ins><code>
first
<del class="diff-old">keys:
</del>
</code>
<ins class="diff-chg">member
it
does
not
represent
the
head
of
a
</ins><a href="#dfn-list" title="list" class="tref internalDFN"><ins class="diff-chg">
list
</ins></a>.<ins class="diff-chg">
Continue
with
the
next
key-value
pair.
</ins></li>
<li>
<del class="diff-old">Set
value
to
</del>
<ins class="diff-chg">Reference
</ins>
the
value
of
<ins class="diff-chg">the
</ins><code>
head
</code>
<ins class="diff-chg">member
</ins>
in
<i>
entry
<del class="diff-old">.
</del>
</i>
<ins class="diff-chg">using
the
variable
</ins><i><ins class="diff-chg">
value
</ins></i>.
</li>
<li>
Remove
the
<del class="diff-old">entry
for
</del>
<code>
@id
</code>
<del class="diff-old">in
</del>
<ins class="diff-chg">member
from
</ins><i>
value
<del class="diff-old">.
</del>
</i>.
</li>
<li>
Add
an
<del class="diff-old">entry
to
value
for
</del>
<code>
@list
</code>
<del class="diff-old">initialized
</del>
<ins class="diff-chg">member
</ins>
to
<del class="diff-old">a
new
</del>
<i>
<ins class="diff-chg">value
</ins></i><ins class="diff-chg">
and
initialize
it
to
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN">
array
</a>
containing
the
value
of
<ins class="diff-chg">the
</ins><code>
first
<del class="diff-old">from
</del>
</code>
<ins class="diff-chg">member
of
</ins><i>
entry
<del class="diff-old">.
</del>
</i>.
</li>
<li>
While
<del class="diff-old">entry
has
a
key
for
</del>
<ins class="diff-chg">the
value
associated
with
the
</ins><code>
rest
<del class="diff-old">:
</del>
</code>
<ins class="diff-chg">member
of
</ins><i><ins class="diff-chg">
entry
</ins></i><ins class="diff-chg">
is
not
</ins><code><ins class="diff-chg">
rdf:nil
</ins></code>:
<ol class="algorithm">
<li>
Set
<i>
<ins class="diff-chg">rest
</ins></i><ins class="diff-chg">
to
the
value
of
the
</ins><code><ins class="diff-chg">
rest
</ins></code><ins class="diff-chg">
member
of
</ins><i>
entry
</i>.
</li>
<li>
<ins class="diff-chg">Set
</ins><i><ins class="diff-chg">
entry
</ins></i>
to
the
value
<ins class="diff-new">associated
with
the
</ins><i><ins class="diff-new">
rest
</ins></i><ins class="diff-new">
member
</ins>
of
<del class="diff-old">graph.listMap
for
entry.rest
.
</del>
<i>
<ins class="diff-chg">list
map
</ins></i>.
</li>
<li>
Add
the
value
<del class="diff-old">for
entry.first
</del>
<ins class="diff-chg">associated
with
the
</ins><code><ins class="diff-chg">
first
</ins></code><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
entry
</ins></i>
to
the
<del class="diff-old">list
array.
</del>
<code>
<ins class="diff-chg">@list
</ins></code><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
value
</ins></i>.
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>
<del class="diff-old">Create
array
as
</del>
<ins class="diff-chg">Initialize
</ins>
an
empty
<a href="#dfn-array" title="array" class="tref internalDFN">
array
<del class="diff-old">.
</del>
</a>
<i>
<ins class="diff-chg">result
</ins></i>.
</li>
<li>
For
each
<i>
subject
</i>
and
<del class="diff-old">entry
</del>
<i>
<ins class="diff-chg">node
</ins></i>
in
<del class="diff-old">defaultGraph.nodes
</del>
<i>
<ins class="diff-chg">default
graph
nodes
</ins></i>
ordered
by
<i>
subject
<del class="diff-old">:
</del>
</i>:
<ol class="algorithm">
<li>
<del class="diff-old">Add
entry
to
array
.
</del>
If
<del class="diff-old">graphs
</del>
<i>
<ins class="diff-chg">graph
map
</ins></i>
has
an
<del class="diff-old">entry
for
</del>
<i>
subject
<del class="diff-old">,
add
</del>
</i>
<ins class="diff-chg">member:
</ins><ol class="algorithm"><li><ins class="diff-chg">
Add
</ins>
a
<del class="diff-old">property
</del>
<code>
@graph
</code>
<del class="diff-old">in
entry
containing
</del>
<ins class="diff-chg">member
to
</ins><i><ins class="diff-chg">
node
</ins></i><ins class="diff-chg">
and
initialize
its
value
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a>.</li><li><ins class="diff-chg">
Reference
the
</ins><code><ins class="diff-chg">
nodeMap
</ins></code><ins class="diff-chg">
member
of
</ins>
the
<i>
<ins class="diff-new">subject
</ins></i><ins class="diff-new">
member
of
</ins><i><ins class="diff-new">
graph
map
</ins></i><ins class="diff-new">
using
the
variable
</ins><i><ins class="diff-new">
node
map
</ins></i>.</li><li><ins class="diff-new">
For
each
key-value
pair
</ins><i><ins class="diff-new">
s
</ins></i><ins class="diff-new">
-
</ins><i><ins class="diff-new">
n
</ins></i><ins class="diff-new">
in
</ins><i><ins class="diff-new">
node
map
</ins></i>
ordered
<del class="diff-old">entries
from
graphs[subject].nodes
.
</del>
<ins class="diff-chg">by
</ins><i><ins class="diff-chg">
s
</ins></i>,<ins class="diff-chg">
append
</ins><i><ins class="diff-chg">
n
</ins></i><ins class="diff-chg">
to
the
</ins><code><ins class="diff-chg">
@graph
</ins></code><ins class="diff-chg">
member
of
</ins><i><ins class="diff-chg">
node
</ins></i>.</li></ol></li><li><ins class="diff-chg">
Append
</ins><i><ins class="diff-chg">
node
</ins></i><ins class="diff-chg">
to
</ins><i><ins class="diff-chg">
result
</ins></i>.
</li>
</ol>
</li>
<li>
Return
<i>
<ins class="diff-new">result
</ins></i>.</li></ol></section></section><section id="rdf-to-object-conversion"><h3><span class="secno"><ins class="diff-new">
10.5
</ins></span><ins class="diff-new">
RDF
to
Object
Conversion
</ins></h3><p><ins class="diff-new">
This
algorithm
transforms
an
RDF
literal
to
a
JSON-LD
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN"><ins class="diff-new">
value
object
</ins></a><ins class="diff-new">
and
a
RDF
blank
node
or
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
to
an
JSON-LD
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-new">
node
object
</ins></a>.</p><section class="informative"><h4 id="general-solution-17"><ins class="diff-new">
General
Solution
</ins></h4><p>
<em>
<del class="diff-old">array
</del>
<ins class="diff-chg">This
section
is
non-normative.
</ins>
</em>
</p>
<p>
<a href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal" title="rdf-literal" class="tref internalDFN">
<ins class="diff-new">RDF
literals
</ins></a><ins class="diff-new">
are
transformed
to
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN"><ins class="diff-new">
value
objects
</ins></a>
as
<ins class="diff-new">defined
in
the
section
</ins><a href="#data-round-tripping"><ins class="diff-new">
Data
Round
Tripping
</ins></a><ins class="diff-new">
whereas
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><ins class="diff-new">
IRIs
</ins></a><ins class="diff-new">
and
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-new">
blank
node
identifiers
</ins></a><ins class="diff-new">
are
transformed
to
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-new">
node
objects
</ins></a>.</p></section><section><h4 id="algorithm-17"><ins class="diff-new">
Algorithm
</ins></h4><p><ins class="diff-new">
This
algorithm
takes
as
single
input
variable
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
that
is
converted
to
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a>.</p><ol class="algorithm"><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
an
an
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
or
a
</ins><a href="#dfn-blank-node-identifier" title="blank-node-identifier" class="tref internalDFN"><ins class="diff-new">
blank
node
identifier
</ins></a>:<ol class="algorithm"><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
equals
</ins><code><ins class="diff-new">
rdf:nil
</ins></code><ins class="diff-new">
return
a
new
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
consisting
of
a
single
member
</ins><code><ins class="diff-new">
@list
</ins></code><ins class="diff-new">
whose
value
is
set
to
an
empty
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-new">
array
</ins></a>.<ins class="diff-new">
This
is
behavior
is
required
by
</ins>
the
<a href="#convert-from-rdf-algorithm">
<ins class="diff-new">Convert
from
RDF
algorithm
</ins></a>.</li><li><ins class="diff-new">
Otherwise,
return
a
new
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a><ins class="diff-new">
consisting
of
a
single
member
</ins><code><ins class="diff-new">
@id
</ins></code><ins class="diff-new">
whose
value
is
set
to
</ins><i><ins class="diff-new">
value
</ins></i>.</li></ol></li><li><ins class="diff-new">
Otherwise
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
an
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal" title="rdf-literal" class="tref externalDFN"><ins class="diff-new">
RDF
literal
</ins></a>:<ol class="algorithm"><li><ins class="diff-new">
Initialize
a
new
empty
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-new">
JSON
object
</ins></a>
result.
</li>
<li>
<ins class="diff-new">Initialize
</ins><i><ins class="diff-new">
converted
value
</ins></i><ins class="diff-new">
to
</ins><i><ins class="diff-new">
value
</ins></i>.</li><li><ins class="diff-new">
Initialize
</ins><i><ins class="diff-new">
type
</ins></i><ins class="diff-new">
to
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a></li><li><ins class="diff-new">
If
the
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri" title="datatype-iri" class="tref externalDFN"><ins class="diff-new">
datatype
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
of
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
equals
</ins><code><ins class="diff-new">
xsd:boolean
</ins></code>,<ins class="diff-new">
set
</ins><i><ins class="diff-new">
converted
value
</ins></i><ins class="diff-new">
to
</ins><a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-new">
true
</ins></a><ins class="diff-new">
if
the
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form" title="lexical-form" class="tref externalDFN"><ins class="diff-new">
lexical
form
</ins></a><ins class="diff-new">
of
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
matches
</ins><code><ins class="diff-new">
true
</ins></code>,<ins class="diff-new">
or
</ins><code><ins class="diff-new">
false
</ins></code><ins class="diff-new">
if
it
matches
</ins><code><ins class="diff-new">
false
</ins></code>.</li><li><ins class="diff-new">
Otherwise,
if
the
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri" title="datatype-iri" class="tref externalDFN"><ins class="diff-new">
datatype
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
of
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
equals
</ins><code><ins class="diff-new">
xsd:integer
</ins></code><ins class="diff-new">
or
</ins><code><ins class="diff-new">
xsd:double
</ins></code>,<ins class="diff-new">
try
to
convert
the
literal
to
a
</ins><a href="#dfn-number" title="number" class="tref internalDFN"><ins class="diff-new">
JSON
number
</ins></a>.<ins class="diff-new">
If
the
conversion
is
successful,
store
the
result
in
</ins><i><ins class="diff-new">
converted
value
</ins></i>.</li><li><ins class="diff-new">
Otherwise,
if
</ins><i><ins class="diff-new">
value
</ins></i><ins class="diff-new">
is
a
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string" title="language-tagged-string" class="tref externalDFN"><ins class="diff-new">
language-tagged
string
</ins></a><ins class="diff-new">
add
a
member
</ins><code><ins class="diff-new">
@language
</ins></code><ins class="diff-new">
to
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
and
set
its
value
to
the
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag" title="language-tag" class="tref externalDFN"><ins class="diff-new">
language
tag
</ins></a><ins class="diff-new">
of
</ins><i><ins class="diff-new">
value
</ins></i>.</li><li><ins class="diff-new">
Otherwise,
set
</ins><i><ins class="diff-new">
type
</ins></i><ins class="diff-new">
to
the
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri" title="datatype-iri" class="tref externalDFN"><ins class="diff-new">
datatype
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr></a><ins class="diff-new">
of
</ins><i><ins class="diff-new">
value
</ins></i>,<ins class="diff-new">
unless
it
equals
</ins><code><ins class="diff-new">
xsd:string
</ins></code><ins class="diff-new">
which
is
ignored.
</ins></li><li><ins class="diff-new">
Add
a
member
</ins><code><ins class="diff-new">
@value
</ins></code><ins class="diff-new">
to
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
whose
value
is
set
to
</ins><i><ins class="diff-new">
converted
value
</ins></i>.</li><li><ins class="diff-new">
If
</ins><i><ins class="diff-new">
type
</ins></i><ins class="diff-new">
is
not
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>,<ins class="diff-new">
add
a
member
</ins><code><ins class="diff-new">
@type
</ins></code><ins class="diff-new">
to
</ins><i><ins class="diff-new">
result
</ins></i><ins class="diff-new">
whose
value
is
set
to
</ins><i><ins class="diff-new">
type
</ins></i>.</li><li><ins class="diff-new">
Return
</ins><i><ins class="diff-new">
result
</ins></i>.</li></ol></li>
</ol>
</section>
</section>
<section id="data-round-tripping">
<h3>
<span class="secno">
<del class="diff-old">5.16.4
</del>
<ins class="diff-chg">10.6
</ins>
</span>
Data
Round
Tripping
</h3>
<p>
When
<a href="#rdf-conversion">
converting
JSON-LD
to
RDF
</a>
JSON-native
types
such
as
<em>
numbers
</em>
and
<em>
booleans
</em>
are
automatically
coerced
to
<code>
xsd:integer
<del class="diff-old">,
</del>
</code>,
<code>
xsd:double
<del class="diff-old">,
</del>
</code>,
or
<code>
xsd:boolean
<del class="diff-old">.
</del>
</code>.
Implementers
<del class="diff-old">must
</del>
<em title="MUST" class="rfc2119">
<ins class="diff-chg">MUST
</ins>
</em>
ensure
that
the
result
is
in
<a href="#dfn-canonical-lexical-form" title="canonical-lexical-form" class="tref internalDFN">
canonical
lexical
form
</a>.
A
<dfn id="dfn-canonical-lexical-form" title="canonical-lexical-form">
canonical
lexical
form
</dfn>
is
a
set
of
literals
from
among
the
valid
set
of
literals
for
a
datatype
such
that
there
is
a
one-to-one
mapping
between
the
<a href="#dfn-canonical-lexical-form" title="canonical-lexical-form" class="tref internalDFN">
canonical
lexical
form
</a>
and
a
value
in
the
value
space
as
defined
in
[
<cite>
<a href="#bib-XMLSCHEMA11-2" class="bibref">
XMLSCHEMA11-2
</a>
</cite>
].
In
other
words,
every
value
<del class="diff-old">must
</del>
<em title="MUST" class="rfc2119">
<ins class="diff-chg">MUST
</ins>
</em>
be
converted
to
a
deterministic
<a href="#dfn-string" title="string" class="tref internalDFN">
string
</a>
representation.
</p>
<p>
The
canonical
lexical
form
of
an
<em>
integer
</em>,
i.e.,
a
number
without
fractions
or
a
number
coerced
to
<code>
xsd:integer
<del class="diff-old">,
</del>
</code>,
is
a
finite-length
sequence
of
decimal
digits
(
<code>
0-9
</code>
)
with
an
optional
leading
minus
sign;
leading
<del class="diff-old">zeroes
</del>
<ins class="diff-chg">zeros
</ins>
are
prohibited.
To
convert
the
number
in
JavaScript,
implementers
can
use
the
following
snippet
of
code:
</p>
<div class="example">
<div class="example-title">
<span>
Example
12
</span>:
<ins class="diff-chg">Sample
integer
serialization
implementation
in
JavaScript
</ins>
</div>
<pre class="example">
(value).toFixed(0).toString()
</pre>
</div>
<p>
The
canonical
lexical
form
of
a
<em>
double
</em>,
i.e.,
a
number
with
fractions
or
a
number
coerced
to
<code>
xsd:double
<del class="diff-old">,
</del>
</code>,
consists
of
a
mantissa
followed
by
the
character
<del class="diff-old">&quot;E&quot;,
</del>
<ins class="diff-chg">"E",
</ins>
followed
by
an
exponent.
The
mantissa
<del class="diff-old">must
</del>
<em title="MUST" class="rfc2119">
<ins class="diff-chg">MUST
</ins>
</em>
be
a
decimal
number.
The
exponent
<del class="diff-old">must
</del>
<em title="MUST" class="rfc2119">
<ins class="diff-chg">MUST
</ins>
</em>
be
an
integer.
Leading
<del class="diff-old">zeroes
</del>
<ins class="diff-chg">zeros
</ins>
and
a
preceding
plus
sign
(
<code>
+
</code>
)
are
prohibited
in
the
exponent.
If
the
exponent
is
zero,
it
must
be
indicated
by
<code>
E0
</code>.
For
the
mantissa,
the
preceding
optional
plus
sign
is
prohibited
and
the
decimal
point
is
required.
Leading
and
trailing
<del class="diff-old">zeroes
</del>
<ins class="diff-chg">zeros
</ins>
are
prohibited
subject
to
the
following:
number
representations
must
be
normalized
such
that
there
is
a
single
digit
which
is
non-zero
to
the
left
of
the
decimal
point
and
at
least
a
single
digit
to
the
right
of
the
decimal
point
unless
the
value
being
represented
is
zero.
The
canonical
representation
for
zero
is
<code>
0.0E0
</code>.
<code>
xsd:double
</code>
's
value
space
is
defined
by
the
IEEE
double-precision
64-bit
floating
point
type
[
<cite>
<a href="#bib-IEEE-754-1985" class="bibref">
IEEE-754-1985
</a>
</cite>
];
in
JSON-LD
the
mantissa
is
rounded
to
15
digits
after
the
decimal
point.
</p>
<p>
To
convert
the
number
in
JavaScript,
implementers
can
use
the
following
snippet
of
code:
</p>
<div class="example">
<div class="example-title">
<span>
Example
13
</span>:
<ins class="diff-chg">Sample
floating
point
number
serialization
implementation
in
JavaScript
</ins>
</div>
<pre class="example">
(value).toExponential(15).replace(/(\d)0*e\+?/,'$1E')
</pre>
</div>
<div class="note">
<div class="note-title">
<span>
Note
</span>
</div>
<p class="">
When
data
such
as
decimals
need
to
be
normalized,
JSON-LD
authors
should
not
use
values
that
are
going
to
undergo
automatic
conversion.
This
is
due
to
the
lossy
nature
of
<code>
xsd:double
</code>
values.
Authors
should
instead
use
the
expanded
object
form
to
set
the
canonical
lexical
form
directly.
</p>
</div>
<p>
The
canonical
lexical
form
of
the
<em>
boolean
</em>
values
<a href="#dfn-true" title="true" class="tref internalDFN">
true
</a>
and
<a href="#dfn-false" title="false" class="tref internalDFN">
false
</a>
are
the
strings
<code>
true
</code>
and
<code>
false
<del class="diff-old">.
</del>
</code>.
</p>
<p>
When
JSON-native
<a href="#dfn-number" title="number" class="tref internalDFN">
number
</a>
s,
are
type
coerced,
lossless
data
round-tripping
can
not
be
<del class="diff-old">guaranted
</del>
<ins class="diff-chg">guaranteed
</ins>
as
rounding
errors
might
occur.
Additionally,
only
literals
typed
as
<code>
xsd:integer
<del class="diff-old">,
</del>
</code>,
<code>
xsd:double
<del class="diff-old">,
</del>
</code>,
and
<code>
xsd:boolean
</code>
are
automatically
converted
back
to
their
JSON-native
counterparts
in
when
<a href="#rdf-conversion">
converting
from
RDF
</a>.
</p>
<p>
Some
JSON
serializers,
such
as
PHP's
native
implementation
in
some
versions,
backslash-escape
the
forward
slash
character.
For
example,
the
value
<code>
http://example.com/
</code>
would
be
serialized
as
<code>
http:\/\/example.com\/
</code>.
This
is
problematic
as
other
JSON
parsers
might
not
understand
those
escaping
characters.
There
is
no
need
to
backslash-escape
forward
slashes
in
JSON-LD.
To
aid
interoperability
between
JSON-LD
processors,
a
JSON-LD
serializer
<del class="diff-old">must
not
</del>
<em title="MUST NOT" class="rfc2119">
<ins class="diff-chg">MUST
NOT
</ins>
</em>
backslash-escape
forward
slashes.
</p>
</section>
</section>
<section id="the-application-programming-interface">
<h2>
<span class="secno">
<del class="diff-old">6.
</del>
<ins class="diff-chg">11.
</ins>
</span>
The
Application
Programming
Interface
</h2>
<p>
This
API
provides
a
clean
mechanism
that
enables
developers
to
convert
JSON-LD
data
into
a
a
variety
of
output
formats
that
are
<ins class="diff-new">often
</ins>
easier
to
work
<del class="diff-old">with
in
various
programming
languages.
If
a
</del>
<ins class="diff-chg">with.
A
conformant
</ins>
JSON-LD
<del class="diff-old">API
is
provided
in
a
programming
environment,
</del>
<ins class="diff-chg">Processor
</ins><em title="MUST" class="rfc2119"><ins class="diff-chg">
MUST
</ins></em><ins class="diff-chg">
implement
</ins>
the
entirety
of
the
following
<del class="diff-old">API
must
be
implemented.
</del>
<ins class="diff-chg">API.
</ins>
</p>
<section id="jsonldprocessor">
<h3>
<span class="secno">
<del class="diff-old">6.1
</del>
<ins class="diff-chg">11.1
</ins>
</span>
JsonLdProcessor
</h3>
<p>
The
JSON-LD
<del class="diff-old">processor
</del>
<ins class="diff-chg">Processor
</ins>
interface
is
the
high-level
programming
structure
that
developers
use
to
access
the
JSON-LD
transformation
methods.
</p>
<p>
<del class="diff-old">The
JSON-LD
API
signatures
are
the
same
across
all
programming
languages.
Due
to
the
fact
that
asynchronous
programming
is
uncommon
in
certain
languages,
developers
may
implement
a
processor
with
a
synchronous
interface
instead.
In
that
case,
the
callback
parameter
must
not
be
included
and
the
result
must
be
returned
as
a
return
value
instead.
</del>
It
is
important
to
highlight
that
conformant
<a href="#dfn-json-ld-processor" title="json-ld-processor" class="tref internalDFN">
JSON-LD
processors
</a>
<del class="diff-old">must
not
</del>
<em title="MUST NOT" class="rfc2119">
<ins class="diff-chg">MUST
NOT
</ins>
</em>
modify
the
input
parameters.
<ins class="diff-new">If
an
error
is
detected,
the
</ins><i><ins class="diff-new">
callback
</ins></i><ins class="diff-new">
is
invoked
passing
a
</ins><a class="idlType" href="#idl-def-JsonLdError"><code><ins class="diff-new">
JsonLdError
</ins></code></a><ins class="diff-new">
with
the
corresponding
error
</ins><code class="idlMemberName"><a href="#widl-JsonLdError-code"><ins class="diff-new">
code
</ins></a></code><ins class="diff-new">
and
processing
is
stopped.
</ins>
</p>
<del class="diff-old">    ]
interface  {
</del>
    <pre class="idl"><span class="idlInterface" id="idl-def-JsonLdProcessor">[<span class="extAttr">Constructor</span>]
<ins class="diff-chg">interface <span class="idlInterfaceID">JsonLdProcessor</span> {
</ins><span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-expand-void-object-object---DOMString-input-JsonLdCallback-callback-JsonLdOptions-options">expand</a></span> (<span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>object[]</a> or <a>DOMString</a>)</span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType"><a class="idlType" href="#idl-def-JsonLdCallback"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a class="idlType" href="#idl-def-JsonLdOptions"><code>JsonLdOptions</code></a>?</span> <span class="idlParamName">options</span></span>);</span>
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-compact-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options">compact</a></span> (<span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>object[]</a> or <a>DOMString</a>)</span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>DOMString</a>)?</span> <span class="idlParamName">context</span></span>, <span class="idlParam"><span class="idlParamType"><a class="idlType" href="#idl-def-JsonLdCallback"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a class="idlType" href="#idl-def-JsonLdOptions"><code>JsonLdOptions</code></a>?</span> <span class="idlParamName">options</span></span>);</span>
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-JsonLdProcessor-flatten-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options">flatten</a></span> (<span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>object[]</a> or <a>DOMString</a>)</span> <span class="idlParamName">input</span></span>, <span class="idlParam"><span class="idlParamType">(<a>object</a> or <a>DOMString</a>)?</span> <span class="idlParamName">context</span></span>, <span class="idlParam"><span class="idlParamType"><a class="idlType" href="#idl-def-JsonLdCallback"><code>JsonLdCallback</code></a></span> <span class="idlParamName">callback</span></span>, <span class="idlParam">optional <span class="idlParamType"><a class="idlType" href="#idl-def-JsonLdOptions"><code>JsonLdOptions</code></a>?</span> <span class="idlParamName">options</span></span>);</span>
};
</span>
</pre>
<section>
<del class="diff-old">6.1.1
</del>
<h4 id="methods">
Methods
</h4>
<dl class="methods">
<dt id="widl-JsonLdProcessor-compact-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options">
<code>
compact
</code>
</dt>
<dd>
<p>
<a href="#compaction">
Compacts
</a>
the
given
<code>
input
</code>
using
the
<code>
context
</code>
according
to
the
steps
in
the
<a href="#compaction-algorithm">
Compaction
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins></a>:</p><ol class="algorithm"><li><ins class="diff-chg">
If
the
passed
</ins><i><ins class="diff-chg">
input
</ins></i><ins class="diff-chg">
is
a
DOMString
representing
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
of
a
remote
document,
dereference
it.
If
the
retrieved
document
has
a
content
type
different
than
</ins><code><ins class="diff-chg">
application/ld+json
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
application/json
</ins></code><ins class="diff-chg">
or
if
the
document
cannot
be
parsed
as
JSON,
invoke
the
</ins><i><ins class="diff-chg">
callback
</ins></i><ins class="diff-chg">
passing
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.loading-document-failed"><ins class="diff-chg">
loading
document
failed
</ins></a></code><ins class="diff-chg">
error.
</ins></li><li><ins class="diff-chg">
Initialize
a
new
empty
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>.</li><li><ins class="diff-chg">
If
an
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code><ins class="diff-chg">
has
been
passed,
update
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
using
the
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
algorithm
</ins></a>,<ins class="diff-chg">
passing
the
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code><ins class="diff-chg">
as
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>.</li><li><ins class="diff-chg">
If
the
</ins><i><ins class="diff-chg">
input
</ins></i><ins class="diff-chg">
has
been
retrieved
and
the
response
has
a
content
type
</ins><code><ins class="diff-chg">
application/json
</ins></code><ins class="diff-chg">
and
an
HTTP
Link
Header
[
</ins><cite><a href="#bib-RFC5988" class="bibref"><ins class="diff-chg">
RFC5988
</ins></a></cite><ins class="diff-chg">
]
using
the
</ins><code><ins class="diff-chg">
http://www.w3.org/ns/json-ld#context
</ins></code><ins class="diff-chg">
link
relation,
update
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
using
the
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
algorithm
</ins></a>,<ins class="diff-chg">
passing
the
context
referenced
in
the
HTTP
Link
Header
as
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins>
</a>.
</li>
<li>
<ins class="diff-new">Set
</ins><i><ins class="diff-new">
expanded
</ins></i><ins class="diff-new">
to
the
result
of
using
the
</ins><a href="#expansion-algorithm"><ins class="diff-new">
Expansion
algorithm
</ins></a>,<ins class="diff-new">
passing
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a><ins class="diff-new">
and
</ins><i><ins class="diff-new">
input
</ins></i><ins class="diff-new">
as
</ins><i><ins class="diff-new">
element
</ins></i>.</li><li><ins class="diff-new">
Set
</ins><i><ins class="diff-new">
compacted
</ins></i><ins class="diff-new">
to
the
result
of
using
the
</ins><a href="#compaction-algorithm"><ins class="diff-new">
Compaction
algorithm
</ins></a>,<ins class="diff-new">
passing
</ins><i><ins class="diff-new">
context
</ins></i>,<i><ins class="diff-new">
expanded
</ins></i><ins class="diff-new">
as
</ins><i><ins class="diff-new">
element
</ins></i>,<ins class="diff-new">
and
if
passed,
the
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays"><ins class="diff-new">
compactArrays
</ins></a></code><ins class="diff-new">
flag
in
</ins><i><ins class="diff-new">
options
</ins></i>.</li><li><ins class="diff-new">
Invoke
</ins><i><ins class="diff-new">
callback
</ins></i>,<ins class="diff-new">
passing
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
for
</ins><i><ins class="diff-new">
error
</ins></i><ins class="diff-new">
and
</ins><i><ins class="diff-new">
compacted
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
document
</ins></i>.</li></ol>
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
input
</td>
<td class="prmType">
<code>
(
<a>
object
</a>
or
<a>
object[]
</a>
or
<a>
DOMString
</a>
)
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
JSON-LD
object
or
array
of
JSON-LD
objects
to
perform
the
compaction
upon
or
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
referencing
the
JSON-LD
document
to
compact.
</td>
</tr>
<tr>
<td class="prmName">
context
</td>
<td class="prmType">
<code>
(
<a>
object
</a>
or
<a>
DOMString
</a>
)
</code>
</td>
<del class="diff-old">✘
</del>
<td class="prmNullTrue">
<ins class="diff-chg">✔
</ins>
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
context
to
use
when
compacting
the
<code>
input
</code>
;
either
in
the
form
of
<del class="diff-old">an
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
or
as
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</td>
</tr>
<tr>
<td class="prmName">
callback
</td>
<td class="prmType">
<code>
<a class="idlType" href="#idl-def-JsonLdCallback">
<code>
JsonLdCallback
</code>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
A
callback
that
is
called
when
processing
<del class="diff-old">is
complete
</del>
<ins class="diff-chg">completed
successfully
</ins>
on
the
given
<code>
input
<del class="diff-old">.
</del>
</code>,
<ins class="diff-chg">or
a
fatal
error
prevented
processing
from
completing.
</ins>
</td>
</tr>
<tr>
<td class="prmName">
options
</td>
<td class="prmType">
<code>
<a class="idlType" href="#idl-def-JsonLdOptions">
<code>
JsonLdOptions
</code>
</a>
</code>
</td>
<td class="prmNullTrue">
✔
</td>
<td class="prmOptTrue">
✔
</td>
<td class="prmDesc">
A
set
of
options
to
configure
the
<del class="diff-old">used
algorithms
such.
</del>
<ins class="diff-chg">algorithms.
</ins>
This
allows,
e.g.,
to
set
the
input
document's
base
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
<del class="diff-old">This
also
includes
the
optimize
flag,
which,
if
set,
will
allow
processor-specific
optimization.
</del>
</td>
</tr>
</table>
<div>
<em>
Return
type:
</em>
<code>
<a>
void
</a>
</code>
</div>
</dd>
<dt id="widl-JsonLdProcessor-expand-void-object-object---DOMString-input-JsonLdCallback-callback-JsonLdOptions-options">
<code>
expand
</code>
</dt>
<dd>
<p>
<a href="#expansion">
Expands
</a>
the
given
<code>
input
</code>
according
to
the
steps
in
the
<a href="#expansion-algorithm">
Expansion
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins></a>:</p><ol class="algorithm"><li><ins class="diff-chg">
If
the
passed
</ins><i><ins class="diff-chg">
input
</ins></i><ins class="diff-chg">
is
a
DOMString
representing
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
of
a
remote
document,
dereference
it.
If
the
retrieved
document
has
a
content
type
different
than
</ins><code><ins class="diff-chg">
application/ld+json
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
application/json
</ins></code><ins class="diff-chg">
or
if
the
document
cannot
be
parsed
as
JSON,
invoke
the
</ins><i><ins class="diff-chg">
callback
</ins></i><ins class="diff-chg">
passing
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.loading-document-failed"><ins class="diff-chg">
loading
document
failed
</ins></a></code><ins class="diff-chg">
error.
</ins></li><li><ins class="diff-chg">
Initialize
a
new
empty
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>.</li><li><ins class="diff-chg">
If
an
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code><ins class="diff-chg">
has
been
passed,
update
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
using
the
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
algorithm
</ins></a>,<ins class="diff-chg">
passing
the
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code><ins class="diff-chg">
as
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>.</li><li><ins class="diff-chg">
If
the
</ins><i><ins class="diff-chg">
input
</ins></i><ins class="diff-chg">
has
been
retrieved
and
the
response
has
a
content
type
</ins><code><ins class="diff-chg">
application/json
</ins></code><ins class="diff-chg">
and
an
HTTP
Link
Header
[
</ins><cite><a href="#bib-RFC5988" class="bibref"><ins class="diff-chg">
RFC5988
</ins></a></cite><ins class="diff-chg">
]
using
the
</ins><code><ins class="diff-chg">
http://www.w3.org/ns/json-ld#context
</ins></code><ins class="diff-chg">
link
relation,
update
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
using
the
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
algorithm
</ins></a>,<ins class="diff-chg">
passing
the
context
referenced
in
the
HTTP
Link
Header
as
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins>
</a>.
</li>
<li>
<ins class="diff-new">Set
</ins><i><ins class="diff-new">
expanded
</ins></i><ins class="diff-new">
to
the
result
of
using
the
</ins><a href="#expansion-algorithm"><ins class="diff-new">
Expansion
algorithm
</ins></a>,<ins class="diff-new">
passing
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a><ins class="diff-new">
and
</ins><i><ins class="diff-new">
input
</ins></i><ins class="diff-new">
as
</ins><i><ins class="diff-new">
element
</ins></i>.</li><li><ins class="diff-new">
Invoke
</ins><i><ins class="diff-new">
callback
</ins></i>,<ins class="diff-new">
passing
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
for
</ins><i><ins class="diff-new">
error
</ins></i><ins class="diff-new">
and
</ins><i><ins class="diff-new">
expanded
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
document
</ins></i>.</li></ol>
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
input
</td>
<td class="prmType">
<code>
(
<a>
object
</a>
or
<a>
object[]
</a>
or
<a>
DOMString
</a>
)
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
JSON-LD
object
or
array
of
JSON-LD
objects
to
perform
the
expansion
upon
or
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
referencing
the
JSON-LD
document
to
expand.
</td>
</tr>
<tr>
<td class="prmName">
callback
</td>
<td class="prmType">
<code>
<a class="idlType" href="#idl-def-JsonLdCallback">
<code>
JsonLdCallback
</code>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
A
callback
that
is
called
when
processing
<del class="diff-old">is
complete
</del>
<ins class="diff-chg">completed
successfully
</ins>
on
the
given
<code>
input
<del class="diff-old">.
</del>
</code>,
<ins class="diff-chg">or
a
fatal
error
prevented
processing
from
completing.
</ins>
</td>
</tr>
<tr>
<td class="prmName">
options
</td>
<td class="prmType">
<code>
<a class="idlType" href="#idl-def-JsonLdOptions">
<code>
JsonLdOptions
</code>
</a>
</code>
</td>
<td class="prmNullTrue">
✔
</td>
<td class="prmOptTrue">
✔
</td>
<td class="prmDesc">
A
set
of
options
to
configure
the
used
algorithms
such.
This
allows,
e.g.,
to
set
the
input
document's
base
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</td>
</tr>
</table>
<div>
<em>
Return
type:
</em>
<code>
<a>
void
</a>
</code>
</div>
</dd>
<dt id="widl-JsonLdProcessor-flatten-void-object-object---DOMString-input-object-DOMString-context-JsonLdCallback-callback-JsonLdOptions-options">
<code>
flatten
</code>
</dt>
<dd>
<p>
<a href="#flattening">
Flattens
</a>
the
given
<code>
input
</code>
and
<a href="#compaction">
compacts
</a>
it
using
the
passed
<code>
context
</code>
according
to
the
steps
in
the
<a href="#flattening-algorithm">
Flattening
<del class="diff-old">Algorithm
</del>
<ins class="diff-chg">algorithm
</ins></a>:</p><ol class="algorithm"><li><ins class="diff-chg">
If
the
passed
</ins><i><ins class="diff-chg">
input
</ins></i><ins class="diff-chg">
is
a
DOMString
representing
the
</ins><a href="#dfn-iri" title="iri" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
of
a
remote
document,
dereference
it.
If
the
retrieved
document
has
a
content
type
different
than
</ins><code><ins class="diff-chg">
application/ld+json
</ins></code><ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
application/json
</ins></code><ins class="diff-chg">
or
if
the
document
cannot
be
parsed
as
JSON,
invoke
the
</ins><i><ins class="diff-chg">
callback
</ins></i><ins class="diff-chg">
passing
an
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.loading-document-failed"><ins class="diff-chg">
loading
document
failed
</ins></a></code><ins class="diff-chg">
error.
</ins></li><li><ins class="diff-chg">
Initialize
a
new
empty
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a>.</li><li><ins class="diff-chg">
If
an
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code><ins class="diff-chg">
has
been
passed,
update
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
using
the
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
algorithm
</ins></a>,<ins class="diff-chg">
passing
the
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext"><ins class="diff-chg">
expandContext
</ins></a></code><ins class="diff-chg">
as
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>.</li><li><ins class="diff-chg">
If
the
</ins><i><ins class="diff-chg">
input
</ins></i><ins class="diff-chg">
has
been
retrieved
and
the
response
has
a
content
type
</ins><code><ins class="diff-chg">
application/json
</ins></code><ins class="diff-chg">
and
an
HTTP
Link
Header
[
</ins><cite><a href="#bib-RFC5988" class="bibref"><ins class="diff-chg">
RFC5988
</ins></a></cite><ins class="diff-chg">
]
using
the
</ins><code><ins class="diff-chg">
http://www.w3.org/ns/json-ld#context
</ins></code><ins class="diff-chg">
link
relation,
update
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-chg">
active
context
</ins></a><ins class="diff-chg">
using
the
</ins><a href="#context-processing-algorithm"><ins class="diff-chg">
Context
Processing
algorithm
</ins></a>,<ins class="diff-chg">
passing
the
context
referenced
in
the
HTTP
Link
Header
as
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins>
</a>.
</li>
<li>
<ins class="diff-new">Set
</ins><i><ins class="diff-new">
expanded
</ins></i><ins class="diff-new">
to
the
result
of
using
the
</ins><a href="#expansion-algorithm"><ins class="diff-new">
Expansion
algorithm
</ins></a>,<ins class="diff-new">
passing
the
</ins><a href="#dfn-active-context" title="active-context" class="tref internalDFN"><ins class="diff-new">
active
context
</ins></a><ins class="diff-new">
and
</ins><i><ins class="diff-new">
input
</ins></i><ins class="diff-new">
as
</ins><i><ins class="diff-new">
element
</ins></i>.</li><li><ins class="diff-new">
Initialize
an
empty
</ins><i><ins class="diff-new">
identifier
map
</ins></i><ins class="diff-new">
and
a
</ins><i><ins class="diff-new">
counter
</ins></i><ins class="diff-new">
(set
to
</ins><code><ins class="diff-new">
0
</ins></code><ins class="diff-new">
)
to
be
used
by
the
</ins><a href="#generate-blank-node-identifier"><ins class="diff-new">
Generate
Blank
Node
Identifier
algorithm
</ins></a>.</li><li><ins class="diff-new">
Set
</ins><i><ins class="diff-new">
flattened
</ins></i><ins class="diff-new">
to
the
result
of
using
the
</ins><a href="#flattening-algorithm"><ins class="diff-new">
Flattening
algorithm
</ins></a>,<ins class="diff-new">
passing
</ins><i><ins class="diff-new">
expanded
</ins></i><ins class="diff-new">
as
</ins><i><ins class="diff-new">
element
</ins></i>,<i><ins class="diff-new">
context
</ins></i>,<ins class="diff-new">
and
if
passed,
the
</ins><code class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays"><ins class="diff-new">
compactArrays
</ins></a></code><ins class="diff-new">
flag
in
</ins><i><ins class="diff-new">
options
</ins></i><ins class="diff-new">
(which
is
internally
passed
to
the
</ins><a href="#compaction-algorithm"><ins class="diff-new">
Compaction
algorithm
</ins></a><ins class="diff-new">
).
</ins></li><li><ins class="diff-new">
Invoke
</ins><i><ins class="diff-new">
callback
</ins></i>,<ins class="diff-new">
passing
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
for
</ins><i><ins class="diff-new">
error
</ins></i><ins class="diff-new">
and
</ins><i><ins class="diff-new">
flattened
</ins></i><ins class="diff-new">
for
</ins><i><ins class="diff-new">
document
</ins></i>.</li></ol>
<table class="parameters">
<tr>
<th>
Parameter
</th>
<th>
Type
</th>
<th>
Nullable
</th>
<th>
Optional
</th>
<th>
Description
</th>
</tr>
<tr>
<td class="prmName">
input
</td>
<td class="prmType">
<code>
(
<a>
object
</a>
or
<a>
object[]
</a>
or
<a>
DOMString
</a>
)
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
JSON-LD
object
or
array
of
JSON-LD
objects
or
an
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>
referencing
the
JSON-LD
document
to
flatten.
</td>
</tr>
<tr>
<td class="prmName">
context
</td>
<td class="prmType">
<code>
(
<a>
object
</a>
or
<a>
DOMString
</a>
)
</code>
</td>
<td class="prmNullTrue">
✔
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
The
context
to
use
when
compacting
the
flattened
<code>
input
</code>
;
either
in
the
form
of
<del class="diff-old">an
</del>
<ins class="diff-chg">a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN">
JSON
object
</a>
or
as
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
If
<a href="#dfn-null" title="null" class="tref internalDFN">
null
</a>
is
passed,
the
result
will
not
be
compacted
but
<del class="diff-old">keept
</del>
<ins class="diff-chg">kept
</ins>
in
expanded
form.
</td>
</tr>
<tr>
<td class="prmName">
callback
</td>
<td class="prmType">
<code>
<a class="idlType" href="#idl-def-JsonLdCallback">
<code>
JsonLdCallback
</code>
</a>
</code>
</td>
<td class="prmNullFalse">
✘
</td>
<td class="prmOptFalse">
✘
</td>
<td class="prmDesc">
A
callback
that
is
called
when
processing
<del class="diff-old">is
complete
</del>
<ins class="diff-chg">completed
successfully
</ins>
on
the
given
<code>
input
<del class="diff-old">.
</del>
</code>,
<ins class="diff-chg">or
a
fatal
error
prevented
processing
from
completing.
</ins>
</td>
</tr>
<tr>
<td class="prmName">
options
</td>
<td class="prmType">
<code>
<a class="idlType" href="#idl-def-JsonLdOptions">
<code>
JsonLdOptions
</code>
</a>
</code>
</td>
<td class="prmNullTrue">
✔
</td>
<td class="prmOptTrue">
✔
</td>
<td class="prmDesc">
A
set
of
options
to
configure
the
used
algorithms
such.
This
allows,
e.g.,
to
set
the
input
document's
base
<a href="#dfn-iri" title="iri" class="tref internalDFN">
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
</td>
</tr>
</table>
<div>
<em>
Return
type:
</em>
<code>
<a>
void
</a>
</code>
</div>
</dd>
</dl>
</section>
</section>
<section id="callbacks">
<h3>
<span class="secno">
<del class="diff-old">6.2
</del>
<ins class="diff-chg">11.2
</ins>
</span>
Callbacks
</h3>
<p>
JSON-LD
processors
utilize
callbacks
in
order
to
<del class="diff-old">return
</del>
<ins class="diff-chg">exchange
</ins>
information
in
an
asynchronous
manner
<del class="diff-old">to
calling
</del>
<ins class="diff-chg">with
</ins>
applications.
This
section
details
the
parameters
<del class="diff-old">sent
to
</del>
<ins class="diff-chg">of
</ins>
those
callbacks.
</p>
<del class="diff-old">6.2.1
</del>
<section>
<h4 id="jsonldcallback">
JsonLdCallback
</h4>
<p>
The
<a class="idlType" href="#idl-def-JsonLdCallback">
<code>
JsonLdCallback
</code>
</a>
is
called
when
<del class="diff-old">processing
of
</del>
an
API
method
of
<a class="idlType" href="#idl-def-JsonLdProcessor">
<code>
JsonLdProcessor
</code>
</a>
has
been
<del class="diff-old">completed
</del>
<ins class="diff-chg">completed,
either
</ins>
successfully
or
<del class="diff-old">been
terminated
</del>
by
<del class="diff-old">an
</del>
<ins class="diff-chg">a
fatal
</ins>
error.
</p>
<pre class="idl">
<span class="idlCallback" id="idl-def-JsonLdCallback">
callback
<span class="idlCallbackID">
JsonLdCallback
</span>
=
<span class="idlCallbackType">
<a>
void
</a>
</span>
(
<span class="idlParam">
<span class="idlParamType">
<a class="idlType" href="#idl-def-JsonLdError">
<code>
<del class="diff-old">JsonLdProcessingError
</del>
<ins class="diff-chg">JsonLdError
</ins>
</code>
</a>
</span>
<span class="idlParamName">
error
</span>
</span>,
<span class="idlParam">
<span class="idlParamType">
<a>
object
or
object
</a>
[]
</span>
<span class="idlParamName">
document
</span>
</span>
);
</span>
</pre>
<section>
<h5 id="callback-jsonldcallback-parameters">
Callback
<a href="#idl-def-JsonLdCallback" class="idlType">
<code>
JsonLdCallback
</code>
</a>
Parameters
</h5>
<dl class="callback-members">
<dt id="widl-JsonLdCallback-error">
<code>
error
</code>
of
type
<span class="idlMemberType">
<a class="idlType" href="#idl-def-JsonLdError">
<code>
<del class="diff-old">JsonLdProcessingError
</del>
<ins class="diff-chg">JsonLdError
</ins>
</code>
</a>
</span>
</dt>
<dd>
If
the
value
is
<a href="#dfn-null" title="null" class="tref internalDFN">
null
<del class="diff-old">,
</del>
</a>,
then
no
<del class="diff-old">error
occurred.
If
the
value
is
non-
null
,
</del>
<ins class="diff-chg">issue
was
detected
during
processing.
Otherwise,
</ins>
a
processing
error
<del class="diff-old">occurred
</del>
<ins class="diff-chg">was
detected
</ins>
and
the
details
<del class="diff-old">will
be
</del>
<ins class="diff-chg">are
</ins>
contained
within
the
<em>
error
</em>
object.
</dd>
<dt id="widl-JsonLdCallback-document">
<code>
document
</code>
of
type
array
of
<span class="idlMemberType">
<a>
object
or
object
</a>
</span>
</dt>
<dd>
The
processed
JSON-LD
document.
</dd>
</dl>
</section>
</section>
<section>
<h4 id="loadcontextcallback">
<ins class="diff-new">LoadContextCallback
</ins></h4><p><ins class="diff-new">
The
</ins><a class="idlType" href="#idl-def-LoadContextCallback"><code><ins class="diff-new">
LoadContextCallback
</ins></code></a><ins class="diff-new">
defines
the
callback
that
custom
context
loaders
have
to
implement
to
be
used
to
retrieve
remote
contexts.
</ins></p><pre class="idl"><span class="idlCallback" id="idl-def-LoadContextCallback"><ins class="diff-new">
callback
</ins><span class="idlCallbackID"><ins class="diff-new">
LoadContextCallback
</ins></span><ins class="diff-new">
=
</ins><span class="idlCallbackType"><a><ins class="diff-new">
void
</ins></a></span><ins class="diff-new">
(
</ins><span class="idlParam"><span class="idlParamType"><a><ins class="diff-new">
DOMString
</ins></a></span><span class="idlParamName"><ins class="diff-new">
url
</ins></span></span>,<span class="idlParam"><span class="idlParamType"><a class="idlType" href="#idl-def-ContextLoadedCallback"><code><ins class="diff-new">
ContextLoadedCallback
</ins></code></a></span><span class="idlParamName"><ins class="diff-new">
callback
</ins></span></span><ins class="diff-new">
);
</ins></span></pre><section><h5 id="callback-loadcontextcallback-parameters"><ins class="diff-new">
Callback
</ins><a href="#idl-def-LoadContextCallback" class="idlType"><code><ins class="diff-new">
LoadContextCallback
</ins></code></a><ins class="diff-new">
Parameters
</ins></h5><dl class="callback-members"><dt id="widl-LoadContextCallback-url"><code><ins class="diff-new">
url
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
DOMString
</ins></a></span></dt><dd><ins class="diff-new">
The
URL
of
the
remote
context
to
load.
</ins></dd><dt id="widl-LoadContextCallback-callback"><code><ins class="diff-new">
callback
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a class="idlType" href="#idl-def-ContextLoadedCallback"><code><ins class="diff-new">
ContextLoadedCallback
</ins></code></a></span></dt><dd><ins class="diff-new">
The
callback
that
is
called
when
the
remote
context
has
been
successfully
loaded
or
an
error
preventing
its
loading
has
been
detected.
</ins></dd></dl></section></section><section><h4 id="contextloadedcallback"><ins class="diff-new">
ContextLoadedCallback
</ins></h4><p><ins class="diff-new">
The
</ins><a class="idlType" href="#idl-def-ContextLoadedCallback"><code><ins class="diff-new">
ContextLoadedCallback
</ins></code></a><ins class="diff-new">
is
called
in
response
to
a
call
of
the
</ins><a class="idlType" href="#idl-def-LoadContextCallback"><code><ins class="diff-new">
LoadContextCallback
</ins></code></a>.</p><pre class="idl"><span class="idlCallback" id="idl-def-ContextLoadedCallback"><ins class="diff-new">
callback
</ins><span class="idlCallbackID"><ins class="diff-new">
ContextLoadedCallback
</ins></span><ins class="diff-new">
=
</ins><span class="idlCallbackType"><a><ins class="diff-new">
void
</ins></a></span><ins class="diff-new">
(
</ins><span class="idlParam"><span class="idlParamType"><a class="idlType" href="#idl-def-JsonLdError"><code><ins class="diff-new">
JsonLdError
</ins></code></a></span><span class="idlParamName"><ins class="diff-new">
error
</ins></span></span>,<span class="idlParam"><span class="idlParamType"><a><ins class="diff-new">
DOMString
</ins></a></span><span class="idlParamName"><ins class="diff-new">
url
</ins></span></span>,<span class="idlParam"><span class="idlParamType"><a><ins class="diff-new">
DOMString
</ins></a></span><span class="idlParamName"><ins class="diff-new">
context
</ins></span></span><ins class="diff-new">
);
</ins></span></pre><section><h5 id="callback-contextloadedcallback-parameters"><ins class="diff-new">
Callback
</ins><a href="#idl-def-ContextLoadedCallback" class="idlType"><code><ins class="diff-new">
ContextLoadedCallback
</ins></code></a><ins class="diff-new">
Parameters
</ins></h5><dl class="callback-members"><dt id="widl-ContextLoadedCallback-error"><code><ins class="diff-new">
error
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a class="idlType" href="#idl-def-JsonLdError"><code><ins class="diff-new">
JsonLdError
</ins></code></a></span></dt><dd><ins class="diff-new">
If
the
value
is
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a>,<ins class="diff-new">
then
no
issue
was
detected
during
processing.
Otherwise,
a
processing
issue
was
detected
and
the
details
are
contained
within
the
</ins><em><ins class="diff-new">
error
</ins></em><ins class="diff-new">
object.
All
errors
</ins><em title="MUST" class="rfc2119"><ins class="diff-new">
MUST
</ins></em><ins class="diff-new">
have
a
</ins><a class="idlType" href="#idl-def-JsonLdErrorCode"><code><ins class="diff-new">
JsonLdErrorCode
</ins></code></a><ins class="diff-new">
of
</ins><code class="error"><a href="#idl-def-JsonLdErrorCode.loading-remote-context-failed"><ins class="diff-new">
loading
remote
context
failed
</ins></a></code>.</dd><dt id="widl-ContextLoadedCallback-url"><code><ins class="diff-new">
url
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
DOMString
</ins></a></span></dt><dd><ins class="diff-new">
The
final
URL
of
the
loaded
JSON-LD
context.
This
is
important
to
handle
HTTP
redirects
properly.
</ins></dd><dt id="widl-ContextLoadedCallback-context"><code><ins class="diff-new">
context
</ins></code><ins class="diff-new">
of
type
</ins><span class="idlMemberType"><a><ins class="diff-new">
DOMString
</ins></a></span></dt><dd><ins class="diff-new">
The
raw
content
of
the
retrieved
JSON-LD
context.
</ins></dd></dl></section></section>
</section>
<section id="data-structures">
<h3>
<span class="secno">
<del class="diff-old">6.3
</del>
<ins class="diff-chg">11.3
</ins>
</span>
Data
Structures
</h3>
<p>
This
section
describes
datatype
definitions
used
within
the
JSON-LD
API.
</p>
<del class="diff-old">6.3.1
</del>
<section>
<h4 id="jsonldoptions">
JsonLdOptions
</h4>
<p>
The
<a class="idlType" href="#idl-def-JsonLdOptions">
<code>
JsonLdOptions
</code>
</a>
type
is
used
to
pass
various
options
to
the
<a class="idlType" href="#idl-def-JsonLdProcessor">
<code>
JsonLdProcessor
</code>
</a>
methods.
</p>
<del class="diff-old">       {
</del>
      <pre class="idl"><span class="idlDictionary" id="idl-def-JsonLdOptions">dictionary <span class="idlDictionaryID">JsonLdOptions</span> {
<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a></span>           <span class="idlMemberName"><a href="#widl-JsonLdOptions-base">base</a></span>;</span>
<span class="idlMember">    <span class="idlMemberType"><a>boolean</a></span>             <span class="idlMemberName"><a href="#widl-JsonLdOptions-compactArrays">compactArrays</a></span> = <span class="idlMemberValue">true</span>;</span>
<span class="idlMember">    <span class="idlMemberType"><a class="idlType" href="#idl-def-LoadContextCallback"><code>LoadContextCallback</code></a></span> <span class="idlMemberName"><a href="#widl-JsonLdOptions-loadContext">loadContext</a></span>;</span>
<span class="idlMember">    <span class="idlMemberType"><a>object or DOMString</a></span> <span class="idlMemberName"><a href="#widl-JsonLdOptions-expandContext">expandContext</a></span> = <span class="idlMemberValue">null</span>;</span>
<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a></span>           <span class="idlMemberName"><a href="#widl-JsonLdOptions-processingMode">processingMode</a></span> = <span class="idlMemberValue">"json-ld-1.0"</span>;</span>
};
</span>
</pre>
<section>
<h5 id="dictionary-jsonldoptions-members">
Dictionary
<a href="#idl-def-JsonLdOptions" class="idlType">
<code>
JsonLdOptions
</code>
</a>
Members
</h5>
<dl class="dictionary-members">
<dt id="widl-JsonLdOptions-base">
<code>
base
</code>
of
type
<span class="idlMemberType">
<a>
DOMString
</a>
</span>
</dt>
<dd>
The
Base
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
to
use
when
expanding
<ins class="diff-new">or
compacting
</ins>
the
document.
This
overrides
the
value
of
<em>
input
</em>
if
it
is
a
<a>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>.
If
not
specified
and
<em>
input
</em>
is
not
an
<a>
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
</a>,
the
base
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
defaults
to
the
current
document
<abbr title="Internationalized Resource Identifier">
IRI
</abbr>
if
in
a
browser
context,
or
the
empty
string
if
there
is
no
document
context.
<div class="issue">
<div class="issue-title">
<a href="https://github.com/json-ld/json-ld.org/issues/223">
<span>
<ins class="diff-new">Issue
223
</ins></span></a>:<ins class="diff-new">
Feature
at
risk
</ins></div><p class="atrisk"><ins class="diff-new">
The
default
value
of
this
option
implies
that
all
IRIs
that
cannot
be
compacted
otherwise
are
transformed
to
relative
IRIs
during
compaction.
To
avoid
that
data
is
being
lost,
developers
thus
have
to
store
the
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-new">
IRI
</ins></abbr><ins class="diff-new">
along
with
the
compacted
document.
This
might
be
problematic
in
practice
and
thus
the
default
behavior
might
be
changed
in
future.
Furthermore,
the
relationship
of
this
option
to
the
</ins><code><ins class="diff-new">
@base
</ins></code><ins class="diff-new">
keyword
(which
is
at
risk)
should
be
further
investigated.
</ins></p></div>
</dd>
<dt id="widl-JsonLdOptions-compactArrays">
<code>
compactArrays
</code>
of
type
<span class="idlMemberType">
<a>
boolean
</a>
</span>,
defaulting
to
<code>
true
</code>
</dt>
<dd>
If
set
to
<code>
true
</code>,
the
JSON-LD
processor
replaces
arrays
with
just
one
element
with
that
element
during
compaction.
If
set
to
<code>
false
</code>,
all
arrays
will
remain
arrays
even
if
they
have
just
one
element.
</dd>
<dt id="widl-JsonLdOptions-expandContext">
<code>
expandContext
</code>
of
type
<span class="idlMemberType">
<a>
object
or
DOMString
</a>
</span>,
defaulting
to
<code>
null
</code>
</dt>
<dd>
A
context
that
is
used
to
initialize
the
active
context
when
expanding
a
document.
</dd>
<dt id="widl-JsonLdOptions-loadContext">
<code>
<del class="diff-old">optimize
</del>
<ins class="diff-chg">loadContext
</ins>
</code>
of
type
<span class="idlMemberType">
<del class="diff-old">boolean
</del>
<a class="idlType" href="#idl-def-LoadContextCallback">
<del class="diff-old">,
defaulting
to
</del>
<code>
<del class="diff-old">false
</del>
<ins class="diff-chg">LoadContextCallback
</ins>
</code>
</a>
</span>
</dt>
<dd>
<del class="diff-old">If
set
to
true
,
the
JSON-LD
processor
is
allowed
to
optimize
the
output
</del>
<ins class="diff-chg">The
callback
</ins>
of
the
<del class="diff-old">Compaction
Algorithm
</del>
<ins class="diff-chg">context
loader
</ins>
to
<del class="diff-old">produce
even
compacter
representations.
The
algorithm
for
compaction
optimization
is
beyond
the
scope
of
this
specification
and
thus
</del>
<ins class="diff-chg">be
used
to
retrieve
remote
contexts.
If
specified,
it
</ins><em title="MUST" class="rfc2119"><ins class="diff-chg">
MUST
</ins></em><ins class="diff-chg">
be
used
to
retrieve
remote
contexts;
otherwise,
if
</ins>
not
<del class="diff-old">defined.
Consequently,
different
implementations
may
</del>
<ins class="diff-chg">specified,
the
processor's
built-in
context
loader
</ins><em title="MUST" class="rfc2119"><ins class="diff-chg">
MUST
</ins>
</em>
<del class="diff-old">implement
different
optimization
algorithms.
</del>
<ins class="diff-chg">be
used.
</ins>
</dd>
<dt id="widl-JsonLdOptions-processingMode">
<code>
<del class="diff-old">useNativeTypes
</del>
<ins class="diff-chg">processingMode
</ins>
</code>
of
type
<span class="idlMemberType">
<a>
<del class="diff-old">boolean
</del>
<ins class="diff-chg">DOMString
</ins>
</a>
</span>,
defaulting
to
<code>
<del class="diff-old">true
</del>
<ins class="diff-chg">"json-ld-1.0"
</ins>
</code>
</dt>
<dd>
If
set
to
<code>
<del class="diff-old">true
</del>
<ins class="diff-chg">json-ld-1.0
</ins>
</code>,
the
JSON-LD
<del class="diff-old">processor
will
try
to
convert
typed
values
to
JSON
native
types
instead
of
using
</del>
<ins class="diff-chg">Processor
</ins><em title="MUST" class="rfc2119"><ins class="diff-chg">
MUST
</ins></em><ins class="diff-chg">
produce
exactly
</ins>
the
<del class="diff-old">expanded
object
form
when
converting
from
RDF
.
xsd:boolean
values
will
be
converted
to
true
or
false
.
xsd:integer
and
xsd:double
values
will
be
converted
to
JSON
numbers
.
useRdfType
of
type
boolean
,
defaulting
to
false
</del>
<ins class="diff-chg">same
results
as
the
algorithms
defined
in
this
specification.
</ins>
If
set
to
<del class="diff-old">true
,
</del>
<ins class="diff-chg">another
value,
</ins>
the
JSON-LD
<del class="diff-old">processor
will
use
</del>
<ins class="diff-chg">Processor
is
allowed
to
extend
or
modify
</ins>
the
<del class="diff-old">expanded
rdf:type
IRI
as
</del>
<ins class="diff-chg">algorithms
defined
in
this
specification
to
enable
application-specific
optimizations.
The
definition
of
such
optimizations
is
beyond
</ins>
the
<del class="diff-old">property
instead
</del>
<ins class="diff-chg">scope
</ins>
of
<ins class="diff-new">this
specification
and
thus
not
defined.
Consequently,
different
implementations
</ins><em title="MAY" class="rfc2119"><ins class="diff-new">
MAY
</ins></em><ins class="diff-new">
implement
different
optimizations.
Developers
</ins><em title="MUST NOT" class="rfc2119"><ins class="diff-new">
MUST
NOT
</ins></em><ins class="diff-new">
define
modes
beginning
with
</ins>
<code>
<del class="diff-old">@type
</del>
<ins class="diff-chg">json-ld
</ins>
</code>
<del class="diff-old">when
converting
from
RDF
.
</del>
<ins class="diff-chg">as
they
are
reserved
for
future
versions
of
this
specification.
</ins>
</dd>
</dl>
</section>
</section>
<del class="diff-old">6.3.2
JsonLdProcessingError
</del>
<section>
<h4 id="jsonlderror">
<ins class="diff-chg">JsonLdError
</ins>
</h4>
<del class="diff-old">Issue
153
Developers
should
note
that
the
details
of
error
handling
are
being
actively
debated.
</del>
<p>
The
<a class="idlType" href="#idl-def-JsonLdError">
<code>
<del class="diff-old">JsonLdProcessingError
</del>
<ins class="diff-chg">JsonLdError
</ins>
</code>
</a>
type
is
used
to
report
<ins class="diff-new">processing
</ins>
errors
to
a
<a class="idlType" href="#idl-def-JsonLdCallback">
<code>
JsonLdCallback
</code>
</a>.
</p>
<del class="diff-old">       {
</del>
      <pre class="idl"><span class="idlDictionary" id="idl-def-JsonLdError">dictionary <span class="idlDictionaryID">JsonLdError</span> {
<span class="idlMember">    <span class="idlMemberType"><a class="idlType" href="#idl-def-JsonLdErrorCode"><code>JsonLdErrorCode</code></a></span> <span class="idlMemberName"><a href="#widl-JsonLdError-code">code</a></span>;</span>
<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>      <span class="idlMemberName"><a href="#widl-JsonLdError-message">message</a></span>;</span>
};
</span>
</pre>
<section>
<h5 id="dictionary-jsonlderror-members">
Dictionary
<a href="#idl-def-JsonLdError" class="idlType">
<code>
<del class="diff-old">JsonLdProcessingError
</del>
<ins class="diff-chg">JsonLdError
</ins>
</code>
</a>
Members
</h5>
<dl class="dictionary-members">
<dt id="widl-JsonLdError-code">
<code>
code
</code>
of
type
<span class="idlMemberType">
<a class="idlType" href="#idl-def-JsonLdErrorCode">
<code>
JsonLdErrorCode
</code>
</a>
</span>
</dt>
<dd>
a
string
representing
the
particular
error
type,
as
described
in
the
various
algorithms
in
this
document.
</dd>
<dt id="widl-JsonLdError-message">
<code>
message
</code>
of
type
<span class="idlMemberType">
<a>
DOMString
</a>
</span>,
nullable
</dt>
<dd>
an
optional
error
message
containing
additional
debugging
information.
The
specific
contents
of
error
messages
are
outside
the
scope
of
this
<del class="diff-old">specification
and
thus
implementation
dependent.
</del>
<ins class="diff-chg">specification.
</ins>
</dd>
</dl>
</section>
</section>
<del class="diff-old">6.3.3
</del>
<section>
<h4 id="jsonlderrorcode">
JsonLdErrorCode
</h4>
<p>
The
<a class="idlType" href="#idl-def-JsonLdErrorCode">
<code>
JsonLdErrorCode
<del class="diff-old">represent
</del>
</code>
</a>
<ins class="diff-chg">represents
</ins>
the
collection
of
valid
JSON-LD
error
codes.
</p>
<del class="diff-old">       {
    &quot;&quot;,
    &quot;&quot;,
    &quot;&quot;
</del>
      <pre class="idl"><span class="idlEnum" id="idl-def-JsonLdErrorCode">enum <span class="idlEnumID">JsonLdErrorCode</span> {
<ins class="diff-chg">    "<a href="#idl-def-JsonLdErrorCode.loading-document-failed" class="idlEnumItem">loading document failed</a>",
    "<a href="#idl-def-JsonLdErrorCode.list-of-lists" class="idlEnumItem">list of lists</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid--index-value" class="idlEnumItem">invalid @index value</a>",
    "<a href="#idl-def-JsonLdErrorCode.conflicting-indexes" class="idlEnumItem">conflicting indexes</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid--id-value" class="idlEnumItem">invalid @id value</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-local-context" class="idlEnumItem">invalid local context</a>",
    "<a href="#idl-def-JsonLdErrorCode.loading-remote-context-failed" class="idlEnumItem">loading remote context failed</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-remote-context" class="idlEnumItem">invalid remote context</a>",
    "<a href="#idl-def-JsonLdErrorCode.recursive-context-inclusion" class="idlEnumItem">recursive context inclusion</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-base-IRI" class="idlEnumItem">invalid base IRI</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-vocab-mapping" class="idlEnumItem">invalid vocab mapping</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-default-language" class="idlEnumItem">invalid default language</a>",
    "<a href="#idl-def-JsonLdErrorCode.keyword-redefinition" class="idlEnumItem">keyword redefinition</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-term-definition" class="idlEnumItem">invalid term definition</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-reverse-property" class="idlEnumItem">invalid reverse property</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-IRI-mapping" class="idlEnumItem">invalid IRI mapping</a>",
    "<a href="#idl-def-JsonLdErrorCode.cyclic-IRI-mapping" class="idlEnumItem">cyclic IRI mapping</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-keyword-alias" class="idlEnumItem">invalid keyword alias</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-type-mapping" class="idlEnumItem">invalid type mapping</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-language-mapping" class="idlEnumItem">invalid language mapping</a>",
    "<a href="#idl-def-JsonLdErrorCode.colliding-keywords" class="idlEnumItem">colliding keywords</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-container-mapping" class="idlEnumItem">invalid container mapping</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-type-value" class="idlEnumItem">invalid type value</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-value-object" class="idlEnumItem">invalid value object</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-value-object-value" class="idlEnumItem">invalid value object value</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-language-tagged-string" class="idlEnumItem">invalid language-tagged string</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-language-tagged-value" class="idlEnumItem">invalid language-tagged value</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-typed-value" class="idlEnumItem">invalid typed value</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-set-or-list-object" class="idlEnumItem">invalid set or list object</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-language-map-value" class="idlEnumItem">invalid language map value</a>",
    "<a href="#idl-def-JsonLdErrorCode.compaction-to-list-of-lists" class="idlEnumItem">compaction to list of lists</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-reverse-property-map" class="idlEnumItem">invalid reverse property map</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid--reverse-value" class="idlEnumItem">invalid @reverse value</a>",
    "<a href="#idl-def-JsonLdErrorCode.invalid-reverse-property-value" class="idlEnumItem">invalid reverse property value</a>"
</ins>
};
</span>
</pre>
<table class="simple">
<tr>
<th colspan="2">
Enumeration
description
</th>
</tr>
<tr>
<td>
<del class="diff-old">INVALID_SYNTAX
</del>
<code id="idl-def-JsonLdErrorCode.loading-document-failed">
<ins class="diff-chg">loading
document
failed
</ins></code></td><td><ins class="diff-chg">
The
document
could
not
be
loaded
or
parsed
as
JSON.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.list-of-lists"><ins class="diff-chg">
list
of
lists
</ins>
</code>
</td>
<td>
A
<del class="diff-old">violation
</del>
<ins class="diff-chg">list
of
lists
was
detected.
List
of
lists
are
not
supported
in
this
version
</ins>
of
<ins class="diff-new">JSON-LD
due
to
</ins>
the
<del class="diff-old">grammar
as
defined
by
</del>
<ins class="diff-chg">algorithmic
complexity
associated
with
conversion
to
RDF.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid--index-value"><ins class="diff-chg">
invalid
@index
value
</ins></code></td><td><ins class="diff-chg">
An
</ins><code><ins class="diff-chg">
@index
</ins></code><ins class="diff-chg">
member
was
encountered
whose
value
was
not
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.conflicting-indexes"><ins class="diff-chg">
conflicting
indexes
</ins></code></td><td><ins class="diff-chg">
Multiple
conflicting
indexes
have
been
found
for
</ins>
the
<del class="diff-old">JSON-LD
syntax
specification
[
</del>
<ins class="diff-chg">same
node.
</ins></td>
<del class="diff-old">JSON-LD
</del>
</tr>
<del class="diff-old">]
</del>
<tr>
<td>
<code id="idl-def-JsonLdErrorCode.invalid--id-value">
<ins class="diff-chg">invalid
@id
value
</ins></code></td><td><ins class="diff-chg">
An
</ins><code><ins class="diff-chg">
@id
</ins></code><ins class="diff-chg">
member
was
encountered
whose
value
was
not
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-local-context"><ins class="diff-chg">
invalid
local
context
</ins></code></td><td><ins class="diff-chg">
In
invalid
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a>
was
detected.
</td>
</tr>
<tr>
<td>
<del class="diff-old">LOAD_ERROR
</del>
<code id="idl-def-JsonLdErrorCode.loading-remote-context-failed">
<ins class="diff-chg">loading
remote
context
failed
</ins>
</code>
</td>
<td>
There
was
a
problem
encountered
loading
a
remote
context.
</td>
</tr>
<tr>
<td>
<del class="diff-old">LIST_OF_LISTS_DETECTED
</del>
<code id="idl-def-JsonLdErrorCode.invalid-remote-context">
<ins class="diff-chg">invalid
remote
context
</ins></code></td><td><ins class="diff-chg">
No
valid
context
document
has
been
found
for
a
referenced,
remote
context.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.recursive-context-inclusion"><ins class="diff-chg">
recursive
context
inclusion
</ins>
</code>
</td>
<td>
A
<del class="diff-old">list
</del>
<ins class="diff-chg">cycle
in
remote
context
inclusions
has
been
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-base-IRI"><ins class="diff-chg">
invalid
base
IRI
</ins></code></td><td><ins class="diff-chg">
An
invalid
</ins><a href="#dfn-base-iri" title="base-iri" class="tref internalDFN"><ins class="diff-chg">
base
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
has
been
detected,
i.e.,
it
is
neither
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
nor
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-vocab-mapping"><ins class="diff-chg">
invalid
vocab
mapping
</ins></code></td><td><ins class="diff-chg">
An
invalid
</ins><a href="#dfn-vocabulary-mapping" title="vocabulary-mapping" class="tref internalDFN"><ins class="diff-chg">
vocabulary
mapping
</ins></a><ins class="diff-chg">
has
been
detected,
i.e.,
it
is
neither
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a><ins class="diff-chg">
nor
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-default-language"><ins class="diff-chg">
invalid
default
language
</ins></code></td><td><ins class="diff-chg">
The
value
</ins>
of
<del class="diff-old">lists
</del>
<ins class="diff-chg">the
</ins><a href="#dfn-default-language" title="default-language" class="tref internalDFN"><ins class="diff-chg">
default
language
</ins></a><ins class="diff-chg">
is
not
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a><ins class="diff-chg">
and
thus
invalid.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.keyword-redefinition"><ins class="diff-chg">
keyword
redefinition
</ins></code></td><td><ins class="diff-chg">
A
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keyword
</ins></a><ins class="diff-chg">
redefinition
has
been
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-term-definition"><ins class="diff-chg">
invalid
term
definition
</ins></code></td><td><ins class="diff-chg">
An
invalid
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
has
been
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-reverse-property"><ins class="diff-chg">
invalid
reverse
property
</ins></code></td><td><ins class="diff-chg">
An
invalid
reverse
property
definition
has
been
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-IRI-mapping"><ins class="diff-chg">
invalid
IRI
mapping
</ins></code></td><td><ins class="diff-chg">
A
</ins><a href="#dfn-local-context" title="local-context" class="tref internalDFN"><ins class="diff-chg">
local
context
</ins></a><ins class="diff-chg">
contains
a
</ins><a href="#dfn-term" title="term" class="tref internalDFN"><ins class="diff-chg">
term
</ins></a><ins class="diff-chg">
that
has
an
invalid
or
missing
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mapping
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.cyclic-IRI-mapping"><ins class="diff-chg">
cyclic
IRI
mapping
</ins></code></td><td><ins class="diff-chg">
A
cycle
in
</ins><a href="#dfn-iri-mapping" title="iri-mapping" class="tref internalDFN"><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr><ins class="diff-chg">
mappings
</ins></a><ins class="diff-chg">
has
been
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-keyword-alias"><ins class="diff-chg">
invalid
keyword
alias
</ins></code></td><td><ins class="diff-chg">
An
invalid
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keyword
</ins></a><ins class="diff-chg">
alias
definition
has
been
encountered.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-type-mapping"><ins class="diff-chg">
invalid
type
mapping
</ins></code></td><td><ins class="diff-chg">
An
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
in
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
was
encountered
whose
value
could
not
be
expanded
to
an
</ins><a href="#dfn-absolute-iri" title="absolute-iri" class="tref internalDFN"><ins class="diff-chg">
absolute
</ins><abbr title="Internationalized Resource Identifier"><ins class="diff-chg">
IRI
</ins></abbr></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-language-mapping"><ins class="diff-chg">
invalid
language
mapping
</ins></code></td><td><ins class="diff-chg">
An
</ins><code><ins class="diff-chg">
@language
</ins></code><ins class="diff-chg">
member
in
a
</ins><a href="#dfn-term-definition" title="term-definition" class="tref internalDFN"><ins class="diff-chg">
term
definition
</ins></a><ins class="diff-chg">
was
encountered
whose
value
</ins>
was
<ins class="diff-new">neither
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-new">
string
</ins></a><ins class="diff-new">
nor
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-new">
null
</ins></a><ins class="diff-new">
and
thus
invalid.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.colliding-keywords"><ins class="diff-new">
colliding
keywords
</ins></code></td><td><ins class="diff-new">
Two
properties
which
expand
to
the
same
keyword
have
been
</ins>
detected.
<del class="diff-old">List
of
lists
</del>
<ins class="diff-chg">This
might
occur
if
a
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keyword
</ins></a><ins class="diff-chg">
and
an
an
alias
thereof
</ins>
are
<ins class="diff-new">used
at
the
same
time.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-container-mapping"><ins class="diff-new">
invalid
container
mapping
</ins></code></td><td><ins class="diff-new">
An
</ins><code><ins class="diff-new">
@container
</ins></code><ins class="diff-new">
member
was
encountered
whose
value
was
</ins>
not
<del class="diff-old">supported
in
this
version
</del>
<ins class="diff-chg">one
</ins>
of
<del class="diff-old">JSON-LD
due
to
</del>
the
<del class="diff-old">algorithmic
complexity
</del>
<ins class="diff-chg">following
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
strings
</ins></a>:<code><ins class="diff-chg">
@list
</ins></code>,<code><ins class="diff-chg">
@set
</ins></code>,<ins class="diff-chg">
or
</ins><code><ins class="diff-chg">
@index
</ins></code>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-type-value"><ins class="diff-chg">
invalid
type
value
</ins></code></td><td><ins class="diff-chg">
An
invalid
value
for
an
</ins><code><ins class="diff-chg">
@type
</ins></code><ins class="diff-chg">
member
has
been
detected,
i.e.,
the
value
was
neither
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
nor
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
of
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
strings
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-value-object"><ins class="diff-chg">
invalid
value
object
</ins></code></td><td><ins class="diff-chg">
A
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN"><ins class="diff-chg">
value
object
</ins></a><ins class="diff-chg">
with
disallowed
members
has
been
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-value-object-value"><ins class="diff-chg">
invalid
value
object
value
</ins></code></td><td><ins class="diff-chg">
An
invalid
value
for
the
</ins><code><ins class="diff-chg">
@value
</ins></code><ins class="diff-chg">
member
of
a
</ins><a href="#dfn-value-object" title="value-object" class="tref internalDFN"><ins class="diff-chg">
value
object
</ins></a><ins class="diff-chg">
has
been
detected,
i.e.,
it
is
neither
a
</ins><a href="#dfn-scalar" title="scalar" class="tref internalDFN"><ins class="diff-chg">
scalar
</ins></a><ins class="diff-chg">
nor
</ins><a href="#dfn-null" title="null" class="tref internalDFN"><ins class="diff-chg">
null
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-language-tagged-string"><ins class="diff-chg">
invalid
language-tagged
string
</ins></code></td><td><ins class="diff-chg">
A
</ins><a href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string" title="language-tagged-string" class="tref internalDFN"><ins class="diff-chg">
language-tagged
string
</ins></a><ins class="diff-chg">
with
an
invalid
language
value
was
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-language-tagged-value"><ins class="diff-chg">
invalid
language-tagged
value
</ins></code></td><td><ins class="diff-chg">
A
</ins><a href="#dfn-number" title="number" class="tref internalDFN"><ins class="diff-chg">
number
</ins></a>,<a href="#dfn-true" title="true" class="tref internalDFN"><ins class="diff-chg">
true
</ins></a>,<ins class="diff-chg">
or
</ins><a href="#dfn-false" title="false" class="tref internalDFN"><ins class="diff-chg">
false
</ins></a><ins class="diff-chg">
with
an
</ins>
associated
<ins class="diff-new">language
tag
was
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-typed-value"><ins class="diff-new">
invalid
typed
value
</ins></code></td><td><ins class="diff-new">
A
</ins><a href="#dfn-typed-value" title="typed-value" class="tref internalDFN"><ins class="diff-new">
typed
value
</ins></a>
with
<del class="diff-old">conversion
</del>
<ins class="diff-chg">an
invalid
type
was
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-set-or-list-object"><ins class="diff-chg">
invalid
set
or
list
object
</ins></code></td><td><ins class="diff-chg">
A
</ins><a href="#dfn-set-object" title="set-object" class="tref internalDFN"><ins class="diff-chg">
set
object
</ins></a><ins class="diff-chg">
or
</ins><a href="#dfn-list-object" title="list-object" class="tref internalDFN"><ins class="diff-chg">
list
object
</ins></a><ins class="diff-chg">
with
disallowed
members
has
been
detected.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-language-map-value"><ins class="diff-chg">
invalid
language
map
value
</ins></code></td><td><ins class="diff-chg">
An
invalid
value
in
a
</ins><a href="../json-ld/#dfn-language-map" title="language-map" class="tref externalDFN"><ins class="diff-chg">
language
map
</ins></a><ins class="diff-chg">
has
been
detected.
It
has
</ins>
to
<del class="diff-old">RDF.
</del>
<ins class="diff-chg">be
a
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
string
</ins></a><ins class="diff-chg">
or
an
</ins><a href="#dfn-array" title="array" class="tref internalDFN"><ins class="diff-chg">
array
</ins></a><ins class="diff-chg">
of
</ins><a href="#dfn-string" title="string" class="tref internalDFN"><ins class="diff-chg">
strings
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.compaction-to-list-of-lists"><ins class="diff-chg">
compaction
to
list
of
lists
</ins></code></td><td><ins class="diff-chg">
The
compacted
document
contains
a
list
of
lists
as
multiple
lists
have
been
compacted
to
the
same
term.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-reverse-property-map"><ins class="diff-chg">
invalid
reverse
property
map
</ins></code></td><td><ins class="diff-chg">
An
invalid
reverse
property
map
has
been
detected.
No
</ins><a href="#dfn-keyword" title="keyword" class="tref internalDFN"><ins class="diff-chg">
keywords
</ins></a><ins class="diff-chg">
apart
from
</ins><code><ins class="diff-chg">
@context
</ins></code><ins class="diff-chg">
are
allowed
in
reverse
property
maps.
</ins></td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid--reverse-value"><ins class="diff-chg">
invalid
@reverse
value
</ins></code></td><td><ins class="diff-chg">
An
invalid
value
for
an
</ins><code><ins class="diff-chg">
@reverse
</ins></code><ins class="diff-chg">
member
has
been
detected,
i.e.,
the
value
was
not
a
</ins><a href="#dfn-json-object" title="json-object" class="tref internalDFN"><ins class="diff-chg">
JSON
object
</ins></a>.</td></tr><tr><td><code id="idl-def-JsonLdErrorCode.invalid-reverse-property-value"><ins class="diff-chg">
invalid
reverse
property
value
</ins></code></td><td><ins class="diff-chg">
An
invalid
value
for
a
reverse
property
has
been
detected.
The
value
of
an
inverse
property
must
be
a
</ins><a href="#dfn-node-object" title="node-object" class="tref internalDFN"><ins class="diff-chg">
node
object
</ins></a>.
</td>
</tr>
</table>
</section>
</section>
</section>
<section id="acknowledgements" class="appendix informative">
<h2>
<span class="secno">
A.
</span>
Acknowledgements
</h2>
<p>
<em>
<ins class="diff-new">This
section
is
non-normative.
</ins></em></p>
<p>
A
large
amount
of
thanks
goes
out
to
the
JSON-LD
Community
Group
participants
who
worked
through
many
of
the
technical
issues
on
the
mailing
list
and
the
weekly
telecons
-
of
special
mention
are
Niklas
Lindström,
François
Daoust,
Lin
Clark,
and
Zdenko
'Denny'
Vrandečić.
The
editors
would
like
to
thank
Mark
Birbeck,
who
provided
a
great
deal
of
the
initial
push
behind
the
JSON-LD
work
via
his
work
on
RDFj.
The
work
of
Dave
Lehn
and
Mike
Johnson
are
appreciated
for
reviewing,
and
performing
several
implementations
of
the
specification.
Ian
Davis
is
thanked
for
his
work
on
RDF/JSON.
Thanks
also
to
Nathan
Rixham,
Bradley
P.
Allen,
Kingsley
Idehen,
Glenn
McDonald,
Alexandre
Passant,
Danny
Ayers,
Ted
Thibodeau
Jr.,
Olivier
Grisel,
Josh
Mandel,
Eric
Prud'hommeaux,
David
Wood,
Guus
Schreiber,
Pat
Hayes,
Sandro
Hawke,
and
Richard
Cyganiak
or
their
input
on
the
specification.
</p>
</section>
<section rel="bibo:chapter" resource="#references" typeof="bibo:Chapter" class="appendix" id="references">
<h2>
<span class="secno">
B.
</span>
References
</h2>
<section rel="bibo:chapter" resource="#normative-references" typeof="bibo:Chapter" id="normative-references">
<h3>
<span class="secno">
B.1
</span>
Normative
references
</h3>
<dl about="" class="bibliography">
<dt id="bib-IEEE-754-1985">
[IEEE-754-1985]
</dt>
<dd rel="dcterms:requires">
IEEE.
<cite>
IEEE
Standard
for
Binary
Floating-Point
Arithmetic.
</cite>
<del class="diff-old">See
</del>
<ins class="diff-chg">URL:
</ins>
<a href="http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html">
http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html
</a>
</dd>
<dt id="bib-JSON-LD">
[JSON-LD]
</dt>
<dd rel="dcterms:requires">
<del class="diff-old">The
JSON-LD
Syntax
</del>
Manu
Sporny,
Gregg
Kellogg,
Markus
<del class="diff-old">Lanthaler
</del>
<ins class="diff-chg">Lanthaler,
</ins>
Editors.
<del class="diff-old">World
Wide
Web
Consortium
(work
in
progress).
22
May
2012.
Editor's
Draft.
This
edition
of
the
JSON-LD
Syntax
specification
is
http://json-ld.org/spec/ED/json-ld-syntax/20120522/.
The
latest
edition
of
the
JSON-LD
Syntax
is
available
at
http://json-ld.org/spec/latest/json-ld-syntax/
[RDF-CONCEPTS]
</del>
<cite>
<del class="diff-old">RDF
1.1
Concepts
and
Abstract
Syntax
</del>
<a href="http://json-ld.org/spec/latest/json-ld-syntax/">
<ins class="diff-chg">JSON-LD
1.0
</ins></a>.
</cite>
<del class="diff-old">Richard
Cyganiak,
David
Wood,
Editors.
World
Wide
Web
Consortium
</del>
<ins class="diff-chg">W3C
Editor's
Draft
</ins>
(work
in
progress).
<del class="diff-old">30
May
2012.
Editor's
Draft.
This
edition
of
the
JSON-LD
Syntax
specification
is
http://www.w3.org/TR/2011/WD-rdf11-concepts-20110830/.
The
latest
edition
of
the
JSON-LD
Syntax
</del>
<ins class="diff-chg">URL:
</ins><a href="http://json-ld.org/spec/latest/json-ld-syntax/"><ins class="diff-chg">
http://json-ld.org/spec/latest/json-ld-syntax/
</ins>
</a>
<del class="diff-old">is
available
at
http://www.w3.org/TR/rdf11-concepts/
</del>
</dd>
<del class="diff-old">[RDF-SCHEMA]
</del>
<dt id="bib-RDF-MT">
<ins class="diff-chg">[RDF-MT]
</ins>
</dt>
<dd rel="dcterms:requires">
<del class="diff-old">Dan
Brickley;
Ramanathan
V.
Guha.
</del>
<ins class="diff-chg">Patrick
Hayes.
</ins><a href="http://www.w3.org/TR/2004/REC-rdf-mt-20040210">
<cite>
RDF
<del class="diff-old">Vocabulary
Description
Language
1.0:
RDF
Schema.
</del>
<ins class="diff-chg">Semantics
</ins>
</cite>
</a>.
10
February
2004.
W3C
Recommendation.
URL:
<del class="diff-old">http://www.w3.org/TR/2004/REC-rdf-schema-20040210
</del>
<a href="http://www.w3.org/TR/2004/REC-rdf-mt-20040210">
<ins class="diff-chg">http://www.w3.org/TR/2004/REC-rdf-mt-20040210
</ins>
</a>
</dd>
<dt id="bib-RFC2119">
[RFC2119]
</dt>
<dd rel="dcterms:requires">
S.
Bradner.
<a href="http://www.ietf.org/rfc/rfc2119.txt">
<cite>
Key
words
for
use
in
RFCs
to
Indicate
Requirement
Levels.
</cite>
</a>
March
1997.
Internet
RFC
2119.
URL:
<a href="http://www.ietf.org/rfc/rfc2119.txt">
http://www.ietf.org/rfc/rfc2119.txt
</a>
</dd>
<dt id="bib-RFC3986">
[RFC3986]
</dt>
<dd rel="dcterms:requires">
T.
Berners-Lee;
R.
Fielding;
L.
Masinter.
<a href="http://www.ietf.org/rfc/rfc3986.txt">
<cite>
Uniform
Resource
Identifier
(URI):
Generic
<del class="diff-old">Syntax.
</del>
<ins class="diff-chg">Syntax
</ins>
</cite>
</a>.
January
2005.
<del class="diff-old">Internet
</del>
RFC
3986.
URL:
<a href="http://www.ietf.org/rfc/rfc3986.txt">
http://www.ietf.org/rfc/rfc3986.txt
</a>
</dd>
<dt id="bib-RFC3987">
[RFC3987]
</dt>
<dd rel="dcterms:requires">
M.
Dürst;
M.
Suignard.
<a href="http://www.ietf.org/rfc/rfc3987.txt">
<cite>
Internationalized
Resource
Identifiers
<del class="diff-old">(IRIs).
</del>
<ins class="diff-chg">(IRIs)
</ins>
</cite>
</a>.
January
2005.
<del class="diff-old">Internet
</del>
RFC
3987.
URL:
<a href="http://www.ietf.org/rfc/rfc3987.txt">
http://www.ietf.org/rfc/rfc3987.txt
</a>
</dd>
<dt id="bib-RFC4627">
[RFC4627]
</dt>
<dd rel="dcterms:requires">
D.
Crockford.
<a href="http://www.ietf.org/rfc/rfc4627.txt">
<cite>
The
application/json
Media
Type
for
JavaScript
Object
Notation
(JSON)
</cite>
</a>.
July
2006.
<del class="diff-old">Internet
</del>
RFC
4627.
URL:
<a href="http://www.ietf.org/rfc/rfc4627.txt">
http://www.ietf.org/rfc/rfc4627.txt
</a>
</dd>
<del class="diff-old">[WEBIDL]
</del>
<dt id="bib-RFC5988">
<ins class="diff-chg">[RFC5988]
</ins>
</dt>
<dd rel="dcterms:requires">
<ins class="diff-chg">M.
Nottingham.
</ins>
<cite>
<a href="http://www.ietf.org/rfc/rfc5988.txt">
Web
<del class="diff-old">IDL
</del>
<ins class="diff-chg">Linking
</ins></a>.</cite><ins class="diff-chg">
October
2010.
Internet
RFC
5988.
URL:
</ins><a href="http://www.ietf.org/rfc/rfc5988.txt"><ins class="diff-chg">
http://www.ietf.org/rfc/rfc5988.txt
</ins>
</a>
</dd>
<dt id="bib-WEBIDL">
<ins class="diff-chg">[WEBIDL]
</ins></dt><dd rel="dcterms:requires">
Cameron
McCormack,
Editor.
<del class="diff-old">World
Wide
</del>
<cite>
<a href="http://www.w3.org/TR/2012/CR-WebIDL-20120419/">
Web
<del class="diff-old">Consortium.
</del>
<ins class="diff-chg">IDL.
</ins></a></cite>
19
April
2012.
<ins class="diff-new">W3C
</ins>
Candidate
<del class="diff-old">Recommendataion.
This
edition
of
Web
IDL
is
http://www.w3.org/TR/2012/CR-WebIDL-20120419/.
</del>
<ins class="diff-chg">Recommendation
(work
in
progress).
URL:
</ins><a href="http://www.w3.org/TR/2012/CR-WebIDL-20120419/"><ins class="diff-chg">
http://www.w3.org/TR/2012/CR-WebIDL-20120419/
</ins></a>.
The
latest
edition
<del class="diff-old">of
Web
IDL
</del>
is
available
at
<del class="diff-old">http://dev.w3.org/2006/webapi/WebIDL/
</del>
<a href="http://www.w3.org/TR/WebIDL/">
<ins class="diff-chg">http://www.w3.org/TR/WebIDL/
</ins></a>
</dd>
<dt id="bib-XMLSCHEMA11-2">
[XMLSCHEMA11-2]
</dt>
<dd rel="dcterms:requires">
Henry
S.
<del class="diff-old">Thompson;
</del>
<ins class="diff-chg">Thompson
</ins>
et
al.
<a href="http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/">
<cite>
W3C
XML
Schema
Definition
Language
(XSD)
1.1
Part
2:
<del class="diff-old">Datatypes.
</del>
<ins class="diff-chg">Datatypes
</ins>
</cite>
</a>.
5
April
2012.
W3C
<del class="diff-old">Recommendation
</del>
<ins class="diff-chg">Recommendation.
</ins>
URL:
<a href="http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/">
http://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/
</a>
</dd>
</dl>
</section>
<section rel="bibo:chapter" resource="#informative-references" typeof="bibo:Chapter" id="informative-references">
<h3>
<span class="secno">
B.2
</span>
Informative
references
</h3>
<dl about="" class="bibliography">
<dt id="bib-BCP47">
[BCP47]
</dt>
<dd rel="dcterms:references">
A.
Phillips;
M.
Davis.
<a href="http://tools.ietf.org/html/bcp47">
<cite>
Tags
for
Identifying
Languages
</cite>
</a>.
September
2009.
IETF
Best
Current
Practice.
URL:
<a href="http://tools.ietf.org/html/bcp47">
http://tools.ietf.org/html/bcp47
</a>
</dd>
<dt id="bib-ECMA-262">
[ECMA-262]
</dt>
<dd rel="dcterms:references">
<a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
<cite>
ECMAScript
Language
Specification.
</cite>
</a>
June
2011.
URL:
<a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
http://www.ecma-international.org/publications/standards/Ecma-262.htm
</a>
</dd>
<dt id="bib-JSON-LD-TESTS">
[JSON-LD-TESTS]
</dt>
<dd rel="dcterms:references">
<cite>
<a href="http://dvcs.w3.org/hg/json-ld/raw-file/default/test-suite/">
JSON-LD
Test
Suite
</a>
</cite>
(work
in
progress).
</dd>
<del class="diff-old">[TURTLE-TR]
</del>
<dt id="bib-RDF11-CONCEPTS">
<ins class="diff-chg">[RDF11-CONCEPTS]
</ins></dt><dd rel="dcterms:references"><ins class="diff-chg">
Richard
Cyganiak,
David
Wood,
Editors.
</ins><cite><a href="http://www.w3.org/TR/2013/WD-rdf11-concepts-20130115/"><ins class="diff-chg">
RDF
1.1
Concepts
and
Abstract
Syntax.
</ins></a></cite><ins class="diff-chg">
15
January
2013.
W3C
Working
Draft
(work
in
progress).
URL:
</ins><a href="http://www.w3.org/TR/2013/WD-rdf11-concepts-20130115/"><ins class="diff-chg">
http://www.w3.org/TR/2013/WD-rdf11-concepts-20130115/
</ins></a>.<ins class="diff-chg">
The
latest
edition
is
available
at
</ins><a href="http://www.w3.org/TR/rdf11-concepts/"><ins class="diff-chg">
http://www.w3.org/TR/rdf11-concepts/
</ins></a></dd><dt id="bib-TURTLE"><ins class="diff-chg">
[TURTLE]
</ins>
</dt>
<dd rel="dcterms:references">
Eric
Prud'hommeaux,
Gavin
<del class="diff-old">Carothers.
</del>
<ins class="diff-chg">Carothers,
Editors.
</ins>
<cite>
<a href="http://www.w3.org/TR/2013/CR-turtle-20130219/">
Turtle:
Terse
RDF
Triple
Language.
</a>
</cite>
<del class="diff-old">09
August
2011.
</del>
<ins class="diff-chg">19
February
2013.
</ins>
W3C
<del class="diff-old">Working
Draft.
</del>
<ins class="diff-chg">Candidate
Recommendation
(work
in
progress).
</ins>
URL:
<del class="diff-old">http://www.w3.org/TR/2011/WD-turtle-20110809/
</del>
<a href="http://www.w3.org/TR/2013/CR-turtle-20130219/">
<ins class="diff-chg">http://www.w3.org/TR/2013/CR-turtle-20130219/
</ins></a>.<ins class="diff-chg">
The
latest
edition
is
available
at
</ins><a href="http://www.w3.org/TR/turtle/"><ins class="diff-chg">
http://www.w3.org/TR/turtle/
</ins>
</a>
</dd>
</dl>
</section>
</section>
</body>
</html>
